fix newline stripping logic in TextStream
close #25