improved date handling