improved newline preservation