Fix StringIO usage