Can you use the C++ style casts (`static_cast<Stg::Model*>(positionmodels[r])`) here and elsewhere in the file rather than the C-style ones?