Fix sorting issues.