remove extra spaces at ends of lines