fixed an issue where a lookup would fail due to recursive children

(cherry picked from commit 896896d9b73137aba16981107e363c91cc6583ac)