modify heapsort