bug fix for datetime