Fixed major bug in hashing function