optimize event hooks