fix up stream read bug