Fix bug importing datetime and replace template