checking for null query_id on state when initialising query.