optional callback for registerHook