diff --git a/pub/src/dualplot.cpp b/pub/src/dualplot.cpp
index 3789a0cf58f51621918119c95df9afaee8b9e75d..b0cfcd994703d4706d5e83b5402e915ff896fabb 100644
--- a/pub/src/dualplot.cpp
+++ b/pub/src/dualplot.cpp
@@ -379,8 +379,14 @@ void CPlot::Line( const bool as_line, const int style_no,
     FILE *gp_fd;
     if (!(gp_fd = fopen(gp_fnam, "w")))
         throw string("cannot save gnuplot data to ") + gp_fnam;
-    for (uint i=0; i<np; i++)
+    for (uint i=0; i<np; i++){
+        // invalid points should be intercepted outside Line(..)
+        if( xp[i]<X.R.inf || xp[i]>X.R.sup )
+            throw "Plot::Line: x["+strg(i)+"]="+strg(xp[i])+" out of range";
+        if( yp[i]<Y.R.inf || yp[i]>Y.R.sup )
+            throw "Plot::Line: y["+strg(i)+"]="+strg(yp[i])+" out of range";
         fprintf(gp_fd, "%16.8g %16.8g\n", xp[i], yp[i]);
+    }
     fclose(gp_fd);
 	
     // Live display:
diff --git a/pub/src/dualplot.h b/pub/src/dualplot.h
index 140157e48a0f5a9e6bbdc7e54621f8083fc4c6e2..79058e317d8c056cfbcc77683d9934d136889b86 100644
--- a/pub/src/dualplot.h
+++ b/pub/src/dualplot.h
@@ -27,7 +27,7 @@ class CAxis {
     bool   log;
     bool   force;
 
-    CAxis( bool _log ) : log(_log) {};
+    CAxis( bool _log ) : log(_log), force(false) {};
 
     void Ask( const string& quest );
     void SetLog( const bool _log );
diff --git a/pub/src/edif.cpp b/pub/src/edif.cpp
index 321aa40bc41647248d64f35399a485f500061a36..2945c7ceb80b4ab39b2d890dbd3c702354dcddf5 100644
--- a/pub/src/edif.cpp
+++ b/pub/src/edif.cpp
@@ -1114,21 +1114,37 @@ void NEdif::Plot( CPlot *plot, bool add )
                 size_t np=0, nxl=0, nxh=0, nyl=0, nyh=0;
                 vector<double> xp, yp;
                 for ( size_t i=0; i<n; i++ ) {
-                    if( !plot->X.force && !plot->X.R.contained(s->x[i]) ) {
-                        if (s->x[i]<=plot->X.R.inf) nxl++;
-                        if (s->x[i]>=plot->X.R.sup) nxh++;
-                        continue;
+                    double x = s->x[i];
+                    if( !plot->X.R.contained(x) ) {
+                        if ( x<=plot->X.R.inf ){
+                            x = plot->X.R.inf;
+                            nxl++;
+                        }
+                        if ( x>=plot->X.R.sup ){
+                            x = plot->X.R.sup;
+                            nxh++;
+                        }
+                        if ( !plot->X.force )
+                            continue;
                     }
-                    if( !plot->Y.force && !plot->Y.R.contained(s->y[i]) ) {
-                        if (s->y[i]<=plot->Y.R.inf) nyl++;
-                        if (s->y[i]>=plot->Y.R.sup) nyh++;
-                        continue;
+                    double y = s->y[i];
+                    if( !plot->Y.R.contained(y) ) {
+                        if ( y<=plot->Y.R.inf ){
+                            y = plot->Y.R.inf;
+                            nyl++;
+                        }
+                        if ( y>=plot->Y.R.sup ){
+                            y = plot->Y.R.sup;
+                            nyh++;
+                        }
+                        if ( !plot->Y.force )
+                            continue;
                     }
                     if( np==plot->maxpoints && np<n ) {
                         printf("reached maxpoints at %g\n", s->x[i]);
                     }
-                    xp.push_back( s->x[i] );
-                    yp.push_back( s->y[i] );
+                    xp.push_back( x );
+                    yp.push_back( y );
                     np = xp.size();
                     if( np > plot->maxpoints ) // continue in large steps
                         i += plot->maxpoints;
diff --git a/pub/src/frida2.cpp b/pub/src/frida2.cpp
index bd071f79d8431852f134f0931049e1eda1bbe5c3..cf9ecce734a4cad5593bb28865fd47a64117da7e 100644
--- a/pub/src/frida2.cpp
+++ b/pub/src/frida2.cpp
@@ -263,6 +263,7 @@ int main()
                     "  gp   plot to complete .ps file\n"
                     "  gf   plot to short .psX file\n"
                     "  gl   list of plot windows\n"
+                    "  g<n> switch to plot window <n>\n"
                     "  gd   dialog (within gnuplot)\n"
                     "  p    plot\n"
                     "  pp   plot with new autoranges\n"