Fixed several windows compatibility issues