Fix for saving to io.BytesIO()