added check for no table queries