Fixed typeless query check