handle CR before LF; close #1781