fix newline handling