Reverting to old guess of # groups, to avoid problems with missing optional groups