Fix memberOf detection. Fixes: #9835