Some static analyzer corrections.
Fixed a crashing but when switching between various streams.