diff --git a/include/class.forms.php b/include/class.forms.php
index 180057e81c3b6ee2c3d340cd6815abb4063c5390..b7bb2f93a54f4afb651b96191e8ee0b635d42e47 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -1766,7 +1766,7 @@ class DatetimeField extends FormField {
 
     function to_database($value) {
         // Store time in gmt time, unix epoch format
-        return date('Y-m-d H:i:s', $value);
+        return $value ? date('Y-m-d H:i:s', $value) : $value;
     }
 
     function to_php($value) {
diff --git a/include/html2text.php b/include/html2text.php
index 0fcaa5cab999744bac97d90e0c8092b476bfbe4c..e7ddedeaf4afb33f5e6c5166cdf0f433d0924bfb 100644
--- a/include/html2text.php
+++ b/include/html2text.php
@@ -1014,7 +1014,7 @@ function mb_wordwrap($string, $width=75, $break="\n", $cut=false) {
   } else {
     // Anchor the beginning of the pattern with a lookahead
     // to avoid crazy backtracking when words are longer than $width
-    $pattern = '/(?=[\s\p{Ps}])(.{1,'.$width.'})(?:\s|$|(\p{Ps}))/uS';
+    $search = '/(?=[\s\p{Ps}])(.{1,'.$width.'})(?:\s|$|(\p{Ps}))/uS';
     $replace = '$1'.$break.'$2';
   }
   return rtrim(preg_replace($search, $replace, $string), $break);