fix NPE while indexing