implement event filtering
fix bug in event matching