Fixed handling of newlines