fixes datetime conversion bug