Fixed error in hash function