Fix some problems by loading query types