Fix sorting by date