Bug fix for datepicker