bug on compilation fixed, refactor for compile with msvc