Fix the logic of reading binary file

Current it can not work on windows

I tested this on windows 7 and other member also helped to tested this Mac, it should work fine