stream rewrite