Fix sorting in refresh