handle io.BytesIO object with file_wrapper

fix #595