Fix a legion of test issues and work around the undo/compaction issue