[TIMOB-13040] Fixed scoping in hooks system. Added better error handling for bad hooks.