Fixed a bug in the sorting