Corrected issues with threading and queries.
activated non_indexed case.