Fix refcounting of streams.