Bug fixed in EventTrigger function