fixes and further develop the C++ example