Index: variable.c
===================================================================
--- variable.c	(revision ad15610ead2550219224b67ce4c2d7da2819e4df)
+++ variable.c	(revision d536e724287f27c032c91f6ac576eb3683f3bd08)
@@ -455,7 +455,9 @@
 
 int owl_variable_dict_setup(owl_vardict *vd) {
-  owl_variable *cur;
+  owl_variable *var, *cur;
   if (owl_dict_create(vd)) return(-1);
-  for (cur = variables_to_init; cur->name != NULL; cur++) {
+  for (var = variables_to_init; var->name != NULL; var++) {
+    cur = owl_malloc(sizeof(owl_variable));
+    memcpy(cur, var, sizeof(owl_variable));
     switch (cur->type) {
     case OWL_VARIABLE_OTHER:
@@ -520,5 +522,5 @@
 void owl_variable_dict_add_variable(owl_vardict * vardict,
                                     owl_variable * var) {
-  owl_dict_insert_element(vardict, var->name, (void*)var, NULL);
+  owl_dict_insert_element(vardict, var->name, (void*)var, (void(*)(void*))owl_variable_free);
 }
 
@@ -532,45 +534,71 @@
 }
 
+void owl_variable_update(owl_variable *var, char *summary, char *desc) {
+  if(var->summary) owl_free(var->summary);
+  var->summary = owl_strdup(summary);
+  if(var->description) owl_free(var->description);
+  var->description = owl_strdup(desc);
+}
+
 void owl_variable_dict_newvar_string(owl_vardict * vd, char *name, char *summ, char * desc, char * initval) {
-  owl_variable * var = owl_variable_newvar(name, summ, desc);
-  var->type = OWL_VARIABLE_STRING;
-  var->pval_default = owl_strdup(initval);
-  var->set_fn = owl_variable_string_set_default;
-  var->set_fromstring_fn = owl_variable_string_set_fromstring_default;
-  var->get_fn = owl_variable_get_default;
-  var->get_tostring_fn = owl_variable_string_get_tostring_default;
-  var->free_fn = owl_variable_free_default;
-  var->set_fn(var, initval);
-  owl_variable_dict_add_variable(vd, var);
+  owl_variable *old = owl_variable_get_var(vd, name, OWL_VARIABLE_STRING);
+  if(old) {
+    owl_variable_update(old, summ, desc);
+    if(old->pval_default) owl_free(old->pval_default);
+    old->pval_default = owl_strdup(initval);
+  } else {
+    owl_variable * var = owl_variable_newvar(name, summ, desc);
+    var->type = OWL_VARIABLE_STRING;
+    var->pval_default = owl_strdup(initval);
+    var->set_fn = owl_variable_string_set_default;
+    var->set_fromstring_fn = owl_variable_string_set_fromstring_default;
+    var->get_fn = owl_variable_get_default;
+    var->get_tostring_fn = owl_variable_string_get_tostring_default;
+    var->free_fn = owl_variable_free_default;
+    var->set_fn(var, initval);
+    owl_variable_dict_add_variable(vd, var);
+  }
 }
 
 void owl_variable_dict_newvar_int(owl_vardict * vd, char *name, char *summ, char * desc, int initval) {
-  owl_variable * var = owl_variable_newvar(name, summ, desc);
-  var->type = OWL_VARIABLE_INT;
-  var->ival_default = initval;
-  var->validate_fn = owl_variable_int_validate_default;
-  var->set_fn = owl_variable_int_set_default;
-  var->set_fromstring_fn = owl_variable_int_set_fromstring_default;
-  var->get_fn = owl_variable_get_default;
-  var->get_tostring_fn = owl_variable_int_get_tostring_default;
-  var->free_fn = owl_variable_free_default;
-  var->val = owl_malloc(sizeof(int));
-  var->set_fn(var, &initval);
-  owl_variable_dict_add_variable(vd, var);
+  owl_variable *old = owl_variable_get_var(vd, name, OWL_VARIABLE_INT);
+  if(old) {
+    owl_variable_update(old, summ, desc);
+    old->ival_default = initval;
+  } else {
+    owl_variable * var = owl_variable_newvar(name, summ, desc);
+    var->type = OWL_VARIABLE_INT;
+    var->ival_default = initval;
+    var->validate_fn = owl_variable_int_validate_default;
+    var->set_fn = owl_variable_int_set_default;
+    var->set_fromstring_fn = owl_variable_int_set_fromstring_default;
+    var->get_fn = owl_variable_get_default;
+    var->get_tostring_fn = owl_variable_int_get_tostring_default;
+    var->free_fn = owl_variable_free_default;
+    var->val = owl_malloc(sizeof(int));
+    var->set_fn(var, &initval);
+    owl_variable_dict_add_variable(vd, var);
+  }
 }
 
 void owl_variable_dict_newvar_bool(owl_vardict * vd, char *name, char *summ, char * desc, int initval) {
-  owl_variable * var = owl_variable_newvar(name, summ, desc);
-  var->type = OWL_VARIABLE_BOOL;
-  var->ival_default = initval;
-  var->validate_fn = owl_variable_bool_validate_default;
-  var->set_fn = owl_variable_bool_set_default;
-  var->set_fromstring_fn = owl_variable_bool_set_fromstring_default;
-  var->get_fn = owl_variable_get_default;
-  var->get_tostring_fn = owl_variable_bool_get_tostring_default;
-  var->free_fn = owl_variable_free_default;
-  var->val = owl_malloc(sizeof(int));
-  var->set_fn(var, &initval);
-  owl_variable_dict_add_variable(vd, var);
+  owl_variable *old = owl_variable_get_var(vd, name, OWL_VARIABLE_BOOL);
+  if(old) {
+    owl_variable_update(old, summ, desc);
+    old->ival_default = initval;
+  } else {
+    owl_variable * var = owl_variable_newvar(name, summ, desc);
+    var->type = OWL_VARIABLE_BOOL;
+    var->ival_default = initval;
+    var->validate_fn = owl_variable_bool_validate_default;
+    var->set_fn = owl_variable_bool_set_default;
+    var->set_fromstring_fn = owl_variable_bool_set_fromstring_default;
+    var->get_fn = owl_variable_get_default;
+    var->get_tostring_fn = owl_variable_bool_get_tostring_default;
+    var->free_fn = owl_variable_free_default;
+    var->val = owl_malloc(sizeof(int));
+    var->set_fn(var, &initval);
+    owl_variable_dict_add_variable(vd, var);
+  }
 }
 
@@ -590,4 +618,5 @@
 void owl_variable_free(owl_variable *v) {
   if (v->free_fn) v->free_fn(v);
+  owl_free(v);
 }
 
@@ -687,10 +716,16 @@
 }
 
-/* returns a reference */
-void *owl_variable_get(owl_vardict *d, char *name, int require_type) {
+owl_variable *owl_variable_get_var(owl_vardict *d, char *name, int require_type) {
   owl_variable *v;
   if (!name) return(NULL);
   v = owl_dict_find_element(d, name);
   if (v == NULL || !v->get_fn || v->type != require_type) return(NULL);
+  return v;
+}
+
+/* returns a reference */
+void *owl_variable_get(owl_vardict *d, char *name, int require_type) {
+  owl_variable *v = owl_variable_get_var(d, name, require_type);
+  if(v == NULL) return NULL;
   return v->get_fn(v);
 }
