fixed memory issues under heavy indexing