Fix warnings and errors on Windows