Fixing replacement of newline characters