fix datetime cast error