[new index structure] Bugfix and tests for clearing indices.