fixed bugs in hash and heap implementations