fix hash routine