fix hash function