bugfixed for new stream logic