Fix queue sorting order fixes #1120
Merge pull request #1421 from alfrix/queue_sort

Fix queue sorting order fixes #1120