fix issue with trailing whitespace leading to extra output line