replace StringIO with io