diff --git a/textimage.admin.inc b/textimage.admin.inc
index 0ad1fda..6163ff2 100644
--- a/textimage.admin.inc
+++ b/textimage.admin.inc
@@ -420,7 +420,7 @@ function textimage_preset_edit($form, &$form_state, $op, $pid = NULL) {
   $form['actions'] = array('#type' => 'actions');
   $form['actions']['submit'] = array(
     '#type'  => 'submit',
-    '#value' => t('Submit'),
+    '#value' => t('Save preset'),
   );
 
   $form['actions']['preview'] = array(
diff --git a/textimage.module b/textimage.module
index d3bebbe..16b0e9f 100644
--- a/textimage.module
+++ b/textimage.module
@@ -485,7 +485,13 @@ function textimage_image_from_preset($preset, $text, $additional_text = array())
       break;
 
     case 'ucwords':
-      $text = preg_replace('/\s(\w+)\b/e', "drupal_ucfirst('$1')", $text);
+      $text = preg_replace_callback(
+        '/\s(\w+)\b/',
+        function ($m) {
+          return drupal_ucfirst($m[1]);
+        },
+        $text
+      );
       break;
   }
 
diff --git a/textimage.utils.inc b/textimage.utils.inc
index ef6b909..90b93d0 100644
--- a/textimage.utils.inc
+++ b/textimage.utils.inc
@@ -224,7 +224,7 @@ if (!function_exists('drupal_preg_match')) {
    */
   function drupal_preg_match($pattern, $subject, &$matches, $flags = NULL, $offset = 0) {
     // Convert the offset value from characters to bytes.
-    $offset = strlen(drupal_substr($subject, 0, $offset));
+    $offset = drupal_strlen(drupal_substr($subject, 0, $offset));
 
     $return_value = preg_match($pattern, $subject, $matches, $flags, $offset);
 
@@ -232,7 +232,7 @@ if (!function_exists('drupal_preg_match')) {
       foreach ($matches as &$match) {
         // Convert the offset returned by preg_match from bytes back to
         // characters.
-        $match[1] = drupal_strlen(substr($subject, 0, $match[1]));
+        $match[1] = drupal_strlen(drupal_substr($subject, 0, $match[1]));
       }
     }
     return $return_value;
