Fixed a bug in the time sort.