Fixes unknown portable field exception when querying

fixes #3927