Use the runtime type of the root (instead of the compile-time type which...

Uses the runtime type of the root (instead of the compile-time type which might be a base class) to create the "persisted" when adding a new root. Fixes #97.