bugfix in generate_folds, now using generate_folds directly in piped