Limit the damage from the previous hack to #define unit
More changes to improve build on MSVC