corrected bug in buildMaxHeap