[WIP] Fix the hash problem

Before:
```
$ ./expand2 
Expanding: ((y + x + z + w)^15 + w)*(y + x + z + w)^15
1574ms
number of terms: 6272
```
After:
```
$ ./expand2
Expanding: ((y + x + z + w)^15 + w)*(y + x + z + w)^15
1704ms
number of terms: 6272
```

Timingwise, this is not as good as #59.