fixed bug in heapsort