Various fixes for Windows