diff --git a/include/class.email.php b/include/class.email.php
index 4eacd8d3189cae5c92493926cb70056c4df24544..4baa862f45c8e3d6eee798cbd20539c31c8cc7ab 100644
--- a/include/class.email.php
+++ b/include/class.email.php
@@ -117,7 +117,9 @@ class Email extends VerySimpleModel {
     }
 
     function getInfo() {
-        return $this->getHashtable();
+        $base = $this->getHashtable();
+        $base['mail_proto'] = $this->mail_proto;
+        return $base;
     }
 
     function getMailAccountInfo() {
@@ -313,7 +315,7 @@ class Email extends VerySimpleModel {
                 ));
 
             if ($id)
-                $existing->filter(array('email_id' => $id));
+                $existing->exclude(array('email_id' => $id));
 
             if ($existing->exists())
                 $errors['userid']=$errors['host']=__('Host/userid combination already in use.');
diff --git a/include/class.format.php b/include/class.format.php
index 81bb58d91ce56b6defeea027a178be85d27dffb4..903256a6f52e983ceda3a93b7395953587f113e3 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -931,13 +931,20 @@ extends FormattedLocalDate {
         return (string) new FormattedLocalDate($this->date, $cfg->getTimezone(), false, $this->fromdb);
     }
 
-    function getVar($what) {
+    function getVar($what, $context) {
         global $cfg;
 
         if ($rv = parent::getVar($what))
             return $rv;
 
         switch ($what) {
+        case 'user':
+            // Fetch $recipient from the context and find that user's time zone
+            if ($recipient = $context->getObj('recipient')) {
+                $tz = $recipient->getTimezone() ?: $cfg->getDefaultTimezone();
+                return new FormattedLocalDate($this->date, $tz, $recipient);
+            }
+            break;
         case 'system':
             return new FormattedLocalDate($this->date, $cfg->getDefaultTimezone());
         }
@@ -947,16 +954,6 @@ extends FormattedLocalDate {
         return Format::relativeTime(Misc::db2gmtime($this->date));
     }
 
-    function getUser($context) {
-        global $cfg;
-
-        // Fetch $recipient from the context and find that user's time zone
-        if ($recipient = $context->getObj('recipient')) {
-            $tz = $recipient->getTimezone() ?: $cfg->getDefaultTimezone();
-            return new FormattedLocalDate($this->date, $tz, $recipient);
-        }
-    }
-
     static function getVarScope() {
         return parent::getVarScope() + array(
             'humanize' => 'Humanized time, e.g. about an hour ago',
diff --git a/include/class.misc.php b/include/class.misc.php
index 259ab675e52f4c19cfb95e3ba9c8501313e623c9..d0a98e1fa4730df7525c3b39f75c6e720f530ac7 100644
--- a/include/class.misc.php
+++ b/include/class.misc.php
@@ -73,6 +73,10 @@ class Misc {
 
         $dbtime = is_int($var) ? $var : strtotime($var);
         $D = DateTime::createFromFormat('U', $dbtime);
+        if (!$D)
+            // This happens e.g. from negative timestamps
+            return $var;
+
         return $dbtime - $dbtz->getOffset($D);
     }
 
diff --git a/include/class.variable.php b/include/class.variable.php
index b6c08c7ff74ea192019f9dff9d1f552764455058..869c87f9b4a6f6f38f458d02bf725abef01165ba 100644
--- a/include/class.variable.php
+++ b/include/class.variable.php
@@ -70,7 +70,7 @@ class VariableReplacer {
 
         list($v, $part) = explode('.', $var, 2);
         if ($v && is_callable(array($obj, 'get'.ucfirst($v)))) {
-            $rv = call_user_func(array($obj, 'get'.ucfirst($v)), $this);
+            $rv = call_user_func(array($obj, 'get'.ucfirst($v)));
             if(!$rv || !is_object($rv))
                 return $rv;
 
@@ -374,7 +374,7 @@ class TextWithExtras {
 
 interface TemplateVariable {
     // function asVar(); — not absolutely required
-    // function getVar($name); — not absolutely required
+    // function getVar($name, $parser); — not absolutely required
     static function getVarScope();
 }
 ?>