More tests, fixes for compacting