changed calculation of stream