Fixed problem in Python 2 when using io.StringIO with dumper.