Fixed produce_subsets to handle lists