Fixes hashing method, added a test for it