Last fix introduced a regression, unsorted order was lost upon sorting. This should correctly fix issue #5