Fix to read file into BytesIO instead of StringIO