typeof: fix query resolution for reference and list:type fields in lookup table