Fixed a bug in the grouping service script.