Bug fix: missing global flag in group numbering function

Added the global flag to the group numbering function as we want to
adjust all of the groups numbers, not just the first one we encounter.