diff --git a/Common/Options.cpp b/Common/Options.cpp
index e28292224e02f0f4e89650f92c05772544c051ba..c11ef940cb0930479234e8548e27c4f5f69eecdc 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.35 2001-07-30 20:22:55 geuzaine Exp $
+// $Id: Options.cpp,v 1.36 2001-07-31 22:20:05 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -507,7 +507,7 @@ char * opt_view_name(OPT_ARGS_STR){
   if(action & GMSH_SET){
     strcpy(v->Name, val);
 #ifdef _FLTK
-    if(WID){
+    if(WID && num<NB_BUTT_MAX){
       WID->m_toggle_butt[num]->label(v->Name);
       WID->m_toggle_butt[num]->redraw();
     }
@@ -1708,7 +1708,7 @@ double opt_view_visible(OPT_ARGS_NUM){
     v->Visible = (int)val;
   }
 #ifdef _FLTK
-  if(WID && (action & GMSH_GUI))
+  if(WID && (action & GMSH_GUI) && num<NB_BUTT_MAX)
     WID->m_toggle_butt[num]->value(v->Visible);
 #endif
   Msg(DEBUG1, "View %d", v->Num);
diff --git a/examples/500views.geo b/examples/500views.geo
new file mode 100644
index 0000000000000000000000000000000000000000..e076db3b9783e046ecabe5aa240dd6940e6b06b3
--- /dev/null
+++ b/examples/500views.geo
@@ -0,0 +1,10 @@
+
+// this tests that we can still load as many views as we want.
+// (even if only 200 are allowed in the GUI)
+
+For i In {0:250}
+
+Include "../tutorial/view1.pos" ;
+Include "../tutorial/view2.pos" ;
+
+EndFor