Revert "back to StringIO"

This reverts commit 153b5678115ec588c78fc740a345ff2286a7fdc9.