Fix some compiler warnings and a bug in C++ wrapper.