replace the internal stream with a non leaking one