tweak to triggerEvent function