fixup! checkpoint finalize work

Add some initial unit tests, and fix stuff based on that.
fixup! checkpoint finalize work

more unit tests, more fixes