Fixed a few bugs related to the C++ runtime.