next_event bug fix