Protect against redeclaring hook function on subsequent calls.