Fix hashing of keys in HashDict

Resolves #1171