Bug-fix: sort on groups too keep groups together.