fixing a bug with datepicker