Fix bug in query var call