Fix memory leak and mono streams.