added debug flag for triggerEvent