Fixing foreign table matching