Fix sorting order for generated UIDs.