Implemented a "safe apply" pattern to the event directives.
Should resolve #5401