fix error handling when accessing a missing group

Case:61348
Merge pull request #363 from dimagi/cz

fix error handling when accessing a missing group