added check for previously hooked function