fix hash-overwriting bug