fixes to hashing algorithm