Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp =================================================================== --- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 20526) +++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (working copy) @@ -3240,9 +3240,9 @@ if (Mpage && (tagName != "MASTERPAGE")) continue; a = m_Doc->currentPage()->pageNr(); - newPage = m_Doc->Pages->at(a); if (Mpage) { + newPage = m_Doc->MasterPages.at(a); newPage->LeftPg = attrs.valueAsInt("LEFT", 0); if (!renamedPageName.isEmpty()) @@ -3250,6 +3250,8 @@ else newPage->setPageName(attrs.valueAsString("NAM","")); } + else + newPage = m_Doc->Pages->at(a); if (attrs.hasAttribute("Size")) newPage->m_pageSize = attrs.valueAsString("Size"); if (attrs.hasAttribute("Orientation")) Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp =================================================================== --- scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 20526) +++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (working copy) @@ -2191,7 +2191,6 @@ if (((pg.tagName()=="PAGE") || (pg.tagName()=="MASTERPAGE")) && (pg.attribute("NUM").toInt() == pageNumber)) { a = m_Doc->currentPage()->pageNr(); - Apage = m_Doc->Pages->at(a); if ((pg.tagName()!="MASTERPAGE") && (Mpage)) { PAGE=PAGE.nextSibling(); @@ -2199,6 +2198,7 @@ } if (Mpage) { + Apage = m_Doc->MasterPages.at(a); Apage->LeftPg=pg.attribute("LEFT", "0").toInt(); if (!renamedPageName.isEmpty()) @@ -2206,6 +2206,8 @@ else Apage->setPageName(pg.attribute("NAM","")); } + else + Apage = m_Doc->Pages->at(a); if (pg.hasAttribute("Size")) Apage->m_pageSize = pg.attribute("Size"); if (pg.hasAttribute("Orientation")) Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp =================================================================== --- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 20526) +++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (working copy) @@ -5985,7 +5985,10 @@ if (Mpage && (tagName != "MASTERPAGE")) continue; a = m_Doc->currentPage()->pageNr(); - newPage = m_Doc->Pages->at(a); + if (Mpage) + newPage = m_Doc->MasterPages.at(a); + else + newPage = m_Doc->Pages->at(a); SimpleState *ss = NULL; if (UndoManager::undoEnabled()) { Index: scribus/scribusdoc.cpp =================================================================== --- scribus/scribusdoc.cpp (revision 20526) +++ scribus/scribusdoc.cpp (working copy) @@ -5602,9 +5602,20 @@ is->set("CREATE_ITEM", "create_item"); is->setItem(newItem); //Undo target rests with the Page for object specific undo - UndoObject *target = Pages->at(0); - if (newItem->OwnPage > -1) - target = Pages->at(newItem->OwnPage); + UndoObject *target; + if (newItem->OnMasterPage.isEmpty()) + { + target = Pages->at(0); + if (newItem->OwnPage > -1) + target = Pages->at(newItem->OwnPage); + } + else + { + target = MasterPages.at(0); + if (newItem->OwnPage > -1) + target = MasterPages.at(newItem->OwnPage); + } + undoManager->action(target, is); //If the item is created "complete" (ie, not being created by drag/resize, commit to undomanager) if (activeTransaction)