fix a heap sort bug