Add safeguard for beat pattern wheelevent
Fix #963