bug fix in output printer, so extra comma is not printed at end of each line