Fixed issue with searching for parent scopes in the lookup functions