Some fixes for Windows compilation