Fix stream completion function