fix hash implementation