fix bug in sortMCGBs