added support for using a writeable stream as an output