better detection of end of stream
Merge branch 'WorkingAroundConnectionsReleasing' into integration