Fixed an access violation while removing a hook.