fixed end_time comparison bug