Fix newline output issues