improved newline handling in console output