correcting order of dates