Fix a bug such that the exit time is incorrectedly recorded