add test for writing streams