adding check for allow query