revised earlier fix to store a reference to the selected template and save a story path instance only when changes are made