fixed when datetime bug