fixed read/write on windows