add empty exprs WriteString test
refactor stream handling