Fixes for C++ compatibility