Find and fix issue resulting in segfaults when indexing over more than 1 thread. Isolated issue for indexing