fixed bug that the hook is added globally