bugfixes in event detection