Fix a bug where user may not always have 'groups' field