diff --git a/Fltk/pluginWindow.cpp b/Fltk/pluginWindow.cpp
index cc2d7575542e356d3648ef88d00a2be824eaac4b..b35c55917498b7f8b0b9b3e7c913faf098f78d15 100644
--- a/Fltk/pluginWindow.cpp
+++ b/Fltk/pluginWindow.cpp
@@ -109,16 +109,8 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view)
   if(!FlGui::instance()->plugins->record->value()) return;
 
   std::string fileName;
-  int oldIndex = -1;
-  if(view){
-    for(int i = 0; i < p->getNbOptions(); i++){
-      if(p->getOption(i)->str == "iView") {
-        oldIndex = p->getOption(i)->def;
-        p->getOption(i)->def = view->getIndex();
-      }
-    }
+  if(view)
     fileName = view->getData()->getFileName();
-  }
   else
     fileName = GModel::current()->getFileName();
 
@@ -131,14 +123,6 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view)
     fprintf(fp, "%s", p->serialize().c_str());
     fclose(fp);
   }
-
-  if(view && oldIndex != -1){
-    for(int i = 0; i < p->getNbOptions(); i++){
-      if(p->getOption(i)->str == "iView"){
-        p->getOption(i)->def = oldIndex;
-      }
-    }
-  }
 }
 
 static void plugin_run_cb(Fl_Widget *w, void *data)
diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp
index ac7e9cc5d8740f57aaa5feb01c656c1e2502a684..e39aa4f8b792850814f0febf336f82af69cbf532 100644
--- a/Plugin/Plugin.cpp
+++ b/Plugin/Plugin.cpp
@@ -78,7 +78,7 @@ PView *GMSH_PostPlugin::executeRemote(PView *view)
 PView *GMSH_PostPlugin::getView(int index, PView *view)
 {
   if(index < 0)
-    index = view ? view->getIndex() : 0;
+    index = view ? view->getIndex() : PView::list.size() - 1;
 
   if(index >= 0 && index < (int)PView::list.size()){
     return PView::list[index];