Fix table relationship handling for lookups of values