fixed a bug with duplicate values for genGroup