MOSYNCLIB-21: Fixed JNI bug introduced when moving from C to C++