Fix heap sort bug.