Fixes to handling of events
Fixes to handling