add filename streams

and attach/detach for output streams