fixed for null queries