event detection bug fix