bug fixes to heapmap