count_sets undefined bug