Fixed bug in usage of datepicker