Bugfix in text format, and tests.