Fix root_builder method

If there is only one kv node in the tree, a corner case has to be handled.
Handle a corner case in modify api implementation
Add compaction api
Add unit test for compaction