Fix compaction and indexing