Fix stream bugs