Improve auto-compaction-related functions