hash: fix crash when adding already inserted keys