fix hash and its checking function