insert cast for C++ compatibility