diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 1b31e882d75025c248c48969627a2af75d617471..11318d4363a7a5f900b1daa5fbbb98c9db2d72ca 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -690,7 +690,7 @@ class DynamicFormEntry extends VerySimpleModel {
     function getForm() {
         if (!isset($this->_form)) {
             $this->_form = DynamicForm::lookup($this->get('form_id'));
-            if (isset($this->id))
+            if ($this->_form && isset($this->id))
                 $this->_form->data($this);
         }
         return $this->_form;
diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index 4e6546549f44d7ad520670bb01af8e946534aaea..1210bffa3f3bfd924169e87939d369c229a4a9ce 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -138,7 +138,7 @@ class MailFetcher {
             $args += array(NULL, 0, array(
                 'DISABLE_AUTHENTICATOR' => array('GSSAPI', 'NTLM')));
 
-        $this->mbox = call_user_func_array('imap_open', $args);
+        $this->mbox = @call_user_func_array('imap_open', $args);
 
         return $this->mbox;
     }
diff --git a/include/class.topic.php b/include/class.topic.php
index 1dd6d0b48f67a6fa9bb3e2c5bbf30e463337990f..9139f9e6d0926efe6d27bc2dc9145ef02f17b151 100644
--- a/include/class.topic.php
+++ b/include/class.topic.php
@@ -256,7 +256,7 @@ class Topic {
 
     static function getHelpTopics($publicOnly=false, $disabled=false) {
         global $cfg;
-        static $topics, $names;
+        static $topics, $names = array();
 
         if (!$names) {
             $sql = 'SELECT topic_id, topic_pid, ispublic, isactive, topic FROM '.TOPIC_TABLE
diff --git a/logout.php b/logout.php
index 4b9ea91b133fae4adf96823b8037428d1ed5acd0..74d73cc377b58049f286551771ff880dfc800fab 100644
--- a/logout.php
+++ b/logout.php
@@ -16,10 +16,9 @@
 
 require('client.inc.php');
 //Check token: Make sure the user actually clicked on the link to logout.
-if(!$thisclient || !$_GET['auth'] || !$ost->validateLinkToken($_GET['auth']))
-   @header('Location: index.php');
+if ($thisclient && $_GET['auth'] && $ost->validateLinkToken($_GET['auth']))
+   $thisclient->logOut();
 
-$thisclient->logOut();
-header('Location: index.php');
-require('index.php');
+
+Http::redirect('index.php');
 ?>