add better error for XSB, query end in lua xsb query func