Issue-141 Query bugfix