Fixed C++ error with pointer reference