Fixed bug in sort order