fixed using more than 2 groups