Adapted to group matrix change.