Fix issues with linking and compiling on WIN32