#787 - save and restore state of dynamically-created instances