Debugging recursive lookup issue