added a clear_events() method for tests