Fix nodes selection in case if pending_roles is not empty

tested by hand