fix next().done in generator