diff --git a/flot.module b/flot.module
index c52bd40..dc9e2c7 100644
--- a/flot.module
+++ b/flot.module
@@ -82,6 +82,7 @@ function template_preprocess_flot_graph(&$variables) {
   if (isset($variables['legend']) && $variables['legend']) {
     if (!isset($options->legend)) {
       // Default position bottom
+      $options->legend = new stdClass();
       $options->legend->show = TRUE;
       $options->legend->position = 'bottom';
     }
@@ -157,6 +158,9 @@ function template_preprocess_flot_graph(&$variables) {
       unset($zoom_options->yaxis->autoscaleMargin);
     }
     foreach ($zoom_data as &$zdata) {
+      if (!isset($zdata->points)) {
+        $zdata->points = new stdClass();
+      }
       $zdata->points->show = FALSE;
     }
     $jszoomdata = '

