fix bug and case is ordered by date