Fix bug with time compare