query fix null indexing