Slight optimization to lookup used in tests.