Fixing compilation and some smaller issues on windows