Unhook the event handler if it causes error.