fix for empty generator in folding code