corrected heapsort and removed errors