fixed infinite loop in insertIntoHT