ignore the last comment, I opened files in write modes, it seems to work if they are binary read mode.