Fix newline handling

Charles asked me to make this commit.