Fix bug: correct heap sort algorithm.