fixed the datetime comparation problem