fix stream bugs