StringIO patch