bug fixes in date functions