Fixes duplicated 'end of stream' messages