Several fixes for the Windows port.