correct heapsort