diff --git a/setup/cli/modules/class.module.php b/setup/cli/modules/class.module.php
index 70c2eebebd730d4aa18f901607c6f00c96f28fed..4ff5c7b1c55e73d8676945311086ff3857514126 100644
--- a/setup/cli/modules/class.module.php
+++ b/setup/cli/modules/class.module.php
@@ -34,7 +34,7 @@ class Option {
 
     function handleValue(&$destination, $args) {
         $nargs = 0;
-        $value = array_shift($args);
+        $value = ($this->hasArg()) ? array_shift($args) : null;
         if ($value[0] == '-')
             $value = null;
         elseif ($value)
@@ -62,7 +62,7 @@ class Option {
     function toString() {
         $short = explode(':', $this->short);
         $long = explode(':', $this->long);
-        if ($this->nargs == '?')
+        if ($this->nargs === '?')
             $switches = sprintf('    %s [%3$s], %s[=%3$s]', $short[0],
                 $long[0], $this->metavar);
         elseif ($this->hasArg())