Fixed issue #1: "AttributeError: StringIO instance has no attribute 'name'"