Fix MC grouping code