Fix issue #8580

Fix issue #8580. Add unit tests for events.