Fixed duplicate root keys fixes #521
another fix for overwritten embed_in_root objects, still need to write test
Merge branch 'feature/duplicate_keys_521'