fix bug in null query creation