Add a little debug code if you drop into the "default" case.

Use EnumGroup() to enumerate group memberships and dump the information somewhere - it might expose the problem. The example in the manual will get you most of the way there.