Improve hashing of expressions