adding some validations for queries