Fixed generate_events call