fixes signalling of stream end