Fix datepicker and sorting