fix date sorting and date cutoff