fixed grouping bug