finally fix generator bug at the source