diff --git a/include/class_templateHandling.inc b/include/class_templateHandling.inc
index 55152ba5eb09398098555494f7ca07f3b86b64ba..4fe0c69286b6d89985c6fd7432c9ae3da9234527 100644
--- a/include/class_templateHandling.inc
+++ b/include/class_templateHandling.inc
@@ -411,7 +411,7 @@ class templateHandling
       }
     }
 
-    return $res;
+    return [$res];
   }
 
   private static function modifierDate (array $args)
@@ -561,11 +561,11 @@ class templateHandling
         break;
       case 'r':
         // random string
-        $result = [static::modifierRandomString($args)];
+        $result = static::modifierRandomString($args);
         break;
       case 'd':
         // date
-        $result = [static::modifierDate($args)];
+        $result = static::modifierDate($args);
         break;
       case 'n':
         // number
diff --git a/include/functions.inc b/include/functions.inc
index 7adf0d993883703ee4f7ddf6721fbcd116b4452e..f305e99e5b99d089995de4fd6b4f1a616e17baf7 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -1968,18 +1968,18 @@ function fopenWithErrorHandling (...$args)
 // Check to see if it exists in case PHP has this function later
 if (!function_exists('mb_substr_replace')) {
   // Same parameters as substr_replace with the extra encoding parameter
-  function mb_substr_replace ($string, $replacement, $start, $length = NULL, $encoding = NULL)
+  function mb_substr_replace (string $string, string $replacement, $start, $length = NULL, $encoding = NULL)
   {
-    if ($encoding == NULL) {
+    if ($encoding === NULL) {
       $encoding = mb_internal_encoding();
     }
-    if ($length == NULL) {
+    if ($length === NULL) {
       return  mb_substr($string, 0, $start, $encoding).
               $replacement;
     } else {
       return  mb_substr($string, 0, $start, $encoding).
               $replacement.
-              mb_substr($string, $start + $length, mb_strlen($string, $encoding), $encoding);
+              mb_substr($string, $start + $length, NULL, $encoding);
     }
   }
 }