Fix undefined variable passed by reference to a hook