function_hooks: improve how function assignments are handled