Add round-trip KDM test. Fix various bugs in KDM generation. Some string -> path.