I'm not sure why your code is failing, but there's a faster way to do what you're doing. Let the DC tell you if the current user is a member of the group, instead of figuring it all out client side.
Some results have been hidden because they may be inaccessible to you
Show inaccessible results