Fix sorting of retrieved partitions