fixed generated code to compile with MSVC