Fix error with sortingByTime method