fix read and write problem on windows

now it is in binary mode