Fixed bug in sendQuery