Fix stream functions