function_hooks: move registration to the right place