Fix for stream not ending.