fixed problem with queries