Fixing bug with smart lookup and adding regression test
Adding an optimization to smart traversal lookup