handle nil times when sorting