newline handling fixed