repaired sort function - indeed repaired dateformat