diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 8baf336e4174219c0d2cfa524d67b95c3c736805..11bb3894c4b5d816c4587f57afaf7d0b38b2b56b 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -1154,9 +1154,13 @@ class DynamicFormEntryAnswer extends VerySimpleModel {
     }
 
     function getValue() {
-        if (!$this->_value && isset($this->value))
+        if (!isset($this->_value) && isset($this->value)) {
+            //XXX: We're settting the value here to avoid infinite loop
+            $this->_value = false;
             $this->_value = $this->getField()->to_php(
                 $this->get('value'), $this->get('value_id'));
+        }
+
         return $this->_value;
     }
 
diff --git a/include/class.group.php b/include/class.group.php
index 24e955f7ce28bffb5e9b804544a65436f96d753a..c8b8e6ef76c36ab51faf0fc1d4e88f75d37f48f3 100644
--- a/include/class.group.php
+++ b/include/class.group.php
@@ -249,6 +249,10 @@ class Group extends VerySimpleModel {
     }
 
     static function create($vars=false) {
+
+        if (!isset($vars['flags']))
+            $vars['flags'] = 0;
+
         $group = parent::create($vars);
         $group->created = SqlFunction::NOW();
         return $group;
diff --git a/include/class.staff.php b/include/class.staff.php
index 955785bd885ec8c72b47540400968b87d56f4a0c..44f7d6302e70558bbfe604b74050d825218836a7 100644
--- a/include/class.staff.php
+++ b/include/class.staff.php
@@ -58,8 +58,15 @@ implements AuthenticatedUser, EmailContact {
     var $_perms = null;
 
     function __onload() {
+
         // WE have to patch info here to support upgrading from old versions.
-        if ($time=strtotime($this->passwdreset ?: (isset($this->added) ? $this->added : '')))
+        $time = null;
+        if (isset($this->passwdreset) && $this->passwdreset)
+            $time=strtotime($this->passwdreset);
+        elseif (isset($this->added) && $this->added)
+            $time=strtotime($this->added);
+
+        if ($time)
             $this->passwd_change = time()-$time; //XXX: check timezone issues.
     }
 
diff --git a/include/pear/Mail.php b/include/pear/Mail.php
index 5d4d3b09dd61c14a501cc52cb8d2f9f1499bb98a..751616debf634aa180b502c5f16a0b0fd5d63418 100644
--- a/include/pear/Mail.php
+++ b/include/pear/Mail.php
@@ -76,14 +76,13 @@ class Mail
         $driver = strtolower($driver);
         $class = 'Mail_' . $driver;
         if (!class_exists($class))
-            include_once PEAR_DIR.'Mail/' . $driver . '.php';
+            include_once 'Mail/' . $driver . '.php';
 
-        if (class_exists($class)) {
-            $mailer = new $class($params);
-            return $mailer;
-        }
+        if (!class_exists($class))
+            return PEAR::raiseError('Unable to find class for driver ' .  $driver);
 
-        return PEAR::raiseError('Unable to find class for driver ' . $driver);
+        $mailer = new $class($params);
+        return $mailer;
     }
 
     /**
diff --git a/include/upgrader/streams/core/03ff59bf-b26f29a6.patch.sql b/include/upgrader/streams/core/03ff59bf-b26f29a6.patch.sql
index ca097c81066c4ca07bc3706868fa4c3d2378f9ec..277b10950b97645e82920fb39aaaed4fced83ed1 100644
--- a/include/upgrader/streams/core/03ff59bf-b26f29a6.patch.sql
+++ b/include/upgrader/streams/core/03ff59bf-b26f29a6.patch.sql
@@ -1,7 +1,7 @@
 /**
  * @version v1.9.4
  * @signature b26f29a6bb5dbb3510b057632182d138
- * @title Add properties filed and drop 'resolved' state
+ * @title Add properties field and drop 'resolved' state
  *
  * This patch drops resolved state and any associated statuses
  *
diff --git a/include/upgrader/streams/core/15b30765-dd0022fb.task.php b/include/upgrader/streams/core/15b30765-dd0022fb.task.php
index 0bf1576190be9a1eb3cd3de3a60f87115fa99e00..faf8c99670670a6e96c8fc95302759e791d26428 100644
--- a/include/upgrader/streams/core/15b30765-dd0022fb.task.php
+++ b/include/upgrader/streams/core/15b30765-dd0022fb.task.php
@@ -18,6 +18,9 @@
 require_once INCLUDE_DIR.'class.migrater.php';
 require_once(INCLUDE_DIR.'class.file.php');
 
+// Later version of osTicket dropped/undefined the table
+@define('TICKET_ATTACHMENT_TABLE', TABLE_PREFIX.'ticket_attachment');
+
 class AttachmentMigrater extends MigrationTask {
     var $description = "Attachment migration from disk to database";
 
diff --git a/include/upgrader/streams/core/36f6b328-5cd0a25a.patch.sql b/include/upgrader/streams/core/36f6b328-5cd0a25a.patch.sql
index e30f48a0b89854d8f79cd8f6b03fdccc2ae00899..56d07587fb37b298d9a5cdc4a31158a7ec346dc3 100644
--- a/include/upgrader/streams/core/36f6b328-5cd0a25a.patch.sql
+++ b/include/upgrader/streams/core/36f6b328-5cd0a25a.patch.sql
@@ -67,7 +67,8 @@ ALTER TABLE  `%TABLE_PREFIX%attachment`
 INSERT INTO `%TABLE_PREFIX%attachment`
     (`object_id`, `type`, `file_id`, `inline`)
     SELECT `ref_id`, 'H', `file_id`, `inline`
-    FROM `%TABLE_PREFIX%ticket_attachment`;
+    FROM `%TABLE_PREFIX%ticket_attachment` A
+    WHERE A.file_id > 0;
 
 -- convert ticket_email_info to thread_entry_email
 ALTER TABLE  `%TABLE_PREFIX%ticket_email_info`