Date/Time function bug fix