Fix pmode problem on windows