fixed group var in goodness function