C++ related fixes