add query validation