fix hash calculation