fixed text_csv to handle arbitrarily long output lines