diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp
index 4432b86c6..34c8691dc 100644
--- a/mscore/musescore.cpp
+++ b/mscore/musescore.cpp
@@ -495,7 +495,7 @@ void MuseScore::preferencesChanged(bool fromWorkspace)
       // change workspace
       if (!fromWorkspace && preferences.getString(PREF_APP_WORKSPACE) != WorkspacesManager::currentWorkspace()->name()) {
             Workspace* workspace = WorkspacesManager::findByName(preferences.getString(PREF_APP_WORKSPACE));
-            
+
             if (workspace)
                   mscore->changeWorkspace(workspace);
             }
@@ -753,7 +753,7 @@ bool MuseScore::importExtension(QString path)
 
                   if (!sfzs.isEmpty())
                         synti->storeState();
-                  
+
                   s->gui()->synthesizerChanged();
                   }
 
@@ -776,7 +776,7 @@ bool MuseScore::importExtension(QString path)
                         }
                   if (!sfs.isEmpty())
                         synti->storeState();
-                  
+
                   s->gui()->synthesizerChanged();
                   }
             };
@@ -843,7 +843,7 @@ bool MuseScore::uninstallExtension(QString extensionId)
                   }
             if (found)
                   synti->storeState();
-            
+
             s->gui()->synthesizerChanged();
             }
       bool refreshWorkspaces = false;
@@ -873,7 +873,7 @@ bool MuseScore::uninstallExtension(QString extensionId)
             bool curWorkspaceDisappeared = false;
             if (WorkspacesManager::findByName(curWorkspaceName))
                   curWorkspaceDisappeared = true;
-            
+
             if (curWorkspaceDisappeared)
                   changeWorkspace(WorkspacesManager::workspaces().last());
             }
@@ -2036,7 +2036,7 @@ void MuseScore::retranslate()
       if (paletteWorkspace)
           paletteWorkspace->retranslate();
       }
-      
+
 //---------------------------------------------------------
 //   setMenuTitles
 //---------------------------------------------------------
@@ -2136,7 +2136,7 @@ void MuseScore::updateMenus()
       addPluginMenuEntries();
 #endif
       }
-      
+
 //---------------------------------------------------------
 //   resizeEvent
 //---------------------------------------------------------
@@ -3485,11 +3485,6 @@ static bool doConvert(Score *cs, const QString& fn);
 
 static bool doConvert(Score* cs, const QJsonArray& outFiles, QString plugin)
       {
-      LayoutMode layoutMode = cs->layoutMode();
-      cs->setLayoutMode(LayoutMode::PAGE);
-      if (cs->layoutMode() != layoutMode)
-            cs->doLayout();
-
       if (!styleFile.isEmpty()) {
             QFile f(styleFile);
             if (f.open(QIODevice::ReadOnly)) {
@@ -3497,6 +3492,13 @@ static bool doConvert(Score* cs, const QJsonArray& outFiles, QString plugin)
                   cs->style().load(&f);
                   }
             }
+
+      LayoutMode layoutMode = cs->layoutMode();
+      if (layoutMode != LayoutMode::PAGE) {
+            cs->setLayoutMode(layoutMode::PAGE);
+            cs->doLayout();
+            }
+
       if (!plugin.isEmpty()) {
             if (mscore->loadPlugin(plugin)) {
                   fprintf(stderr, "\tusing plugin <%s>\n", qPrintable(plugin));
@@ -3649,7 +3651,10 @@ static bool convert(const QString& inFile, const QJsonArray& outFiles, const QSt
       MasterScore* score = mscore->readScore(inFile);
       if (!score)
             return false;
+      mscore->appendScore(score);
       mscore->setCurrentScore(score);
+      mscore->setCurrentView(0, 0);
+      mscore->setCurrentView(1, 0);
       bool success = doConvert(score, outFiles, plugin);
       fprintf(stderr, success ? "... success!\n" : "... failed!\n");
       mscore->setCurrentScore(nullptr);
@@ -3659,7 +3664,10 @@ static bool convert(const QString& inFile, const QJsonArray& outFiles, const QSt
 
 static bool convert(const QString& inFile, const QString& outFile)
       {
-      return convert(inFile, QJsonArray{ outFile });
+      if (pluginMode)
+            return convert(inFile, QJsonArray{ outFile }, pluginName);
+      else
+            return convert(inFile, QJsonArray{ outFile });
       }
 
 //---------------------------------------------------------
@@ -3731,7 +3739,7 @@ static bool processNonGui(const QStringList& argv)
       else if (exportScorePartsPdf)
             return mscore->exportPartsPdfsToJSON(argv[0]);
 
-      if (pluginMode) {
+      if (0) {
             loadScores(argv);
             QString pn(pluginName);
             bool res = false;
@@ -3752,12 +3760,18 @@ static bool processNonGui(const QStringList& argv)
                         cs->setLayoutMode(layoutMode);
                         cs->doLayout();
                         }
+                  QString newfile = "newfile_name.mscx";
+                  QFileInfo fi(newfile);
+                  return cs->saveFile(fi);
+
                   res = true;
                   }
             if (!converterMode)
                   return res;
             }
+
       if (converterMode) {
+            qDebug() << "Running in converter mode";
             if (processJob)
                   return doProcessJob(jsonFileName);
             else
@@ -7746,7 +7760,7 @@ void MuseScore::init(QStringList& argv)
                   Workspace* targetWorkspace = WorkspacesManager::visibleWorkspaces()[0];
                   if (targetWorkspace)
                         mscore->changeWorkspace(targetWorkspace, true);
-                  
+
                   preferences.setPreference(PREF_UI_APP_STARTUP_SHOWTOURS, sw->showTours());
                   delete sw;
 
