Use global references to avoid local ref cleanup before we access ref