Fixed StringIO test failing in some environments