modified the event hook