Fix crash due to storing a reference to the stack.