error next_event fix