Backport of #9848

Fix memberOf detection. Fixes: #9835

Fix remarks in #9848

Fix initializing in #9848