Fix logic error in last commit
Some work on msvc64 compat. Not complete