handle newlines correctly