Fixing datepicker bugs