fixes, rewrite OutStream