Fix for variables toggling their status when the user clicks away from it.
Merge branch 'release_30' into release_31

Fix for variables toggling their status when the user clicks away from it.
Fix TEvent handling so it doesn't crash anymore.