Support trim and chop operations on paths.
Fix bug that caused redundant flushing.

Previously we performed the checkpoing after flushing, causing the old value to
be stored on the filesystem.