Fix for stream not freed