Fixed a sorting bug.