Fix py3 test fail: read/write files as bytes