Fix vars and query