updated the query validation