Fix TEvent handling so it doesn't crash anymore.
Merge branch 'release_31' into development

Fix TEvent handling so it doesn't crash anymore.