performance optimizations, streamfix