Apply fixes for Windows, thanks to Bertrand