Fix sorting of photos by time