Fix C++ crash.