Fix bug in datetime