diff -urP textimage.orig/captcha.inc textimage/captcha.inc
--- textimage.orig/captcha.inc	2007-01-31 22:46:06.000000000 +1300
+++ textimage/captcha.inc	2007-04-27 00:00:19.000000000 +1200
@@ -14,11 +14,11 @@
   $images_path = variable_get("textimage_captcha_images_path", "");
 
   //check for valid font path
-  if ($fonts_path != '' && !file_check_directory($fonts_path)) {
+  if ($fonts_path != '' && !is_dir($fonts_path)) {
     drupal_set_message(t('The current font path is invalid. The default font will be used.'), 'error');
   }
   //check for valid image path
-  if ($images_path != '' && !file_check_directory($images_path)) {
+  if ($images_path != '' && !is_dir($images_path)) {
     drupal_set_message(t('The current images path is invalid. No images will be used.'), 'error');
   }
 
diff -urP textimage.orig/textimage.install textimage/textimage.install
--- textimage.orig/textimage.install	2007-02-06 15:29:38.000000000 +1300
+++ textimage/textimage.install	2007-04-27 00:05:35.000000000 +1200
@@ -16,12 +16,11 @@
 
     case 'pgsql':
       db_query('CREATE TABLE {textimage_preset} (
-        pid INTEGER NOT NULL CHECK (presetid > 0),
+        pid INTEGER PRIMARY KEY CHECK (pid > 0),
         name VARCHAR(255) NOT NULL DEFAULT \'\',
-        settings TEXT NOT NULL DEFAULT \'\'
-        PRIMARY KEY (presetid));'
+        settings TEXT NOT NULL DEFAULT \'\' );'
       );
-      db_query("CREATE SEQUENCE textimage_preset_presetid_seq INCREMENT 1 START 1;");
+      db_query("CREATE SEQUENCE {textimage_preset_pid_seq} INCREMENT 1 START 1;");
       break;
   }
 }
@@ -34,6 +33,10 @@
   if($path != FALSE)
     _textimage_recursive_delete($path);
   
+  if ($GLOBALS['db_type'] == 'pgsql') {
+    db_query('DROP SEQUENCE {textimage_preset_pid_seq};');
+  }
+  
   variable_del('textimage_fonts_path');
   variable_del('textimage_images_path');
   variable_del('textimage_captcha_fonts_path');
@@ -67,12 +70,12 @@
 
     case 'pgsql':
       $ret[] = update_sql('CREATE TABLE {textimage_preset} (
-        pid INTEGER NOT NULL CHECK (presetid > 0),
+        pid INTEGER NOT NULL CHECK (pid > 0),
         name VARCHAR(255) NOT NULL DEFAULT \'\',
-        settings TEXT NOT NULL DEFAULT \'\'
-        PRIMARY KEY (presetid));'
+        settings TEXT NOT NULL DEFAULT \'\',
+        PRIMARY KEY (pid));'
       );
-      $ret[] = update_sql("CREATE SEQUENCE textimage_preset_presetid_seq INCREMENT 1 START 1;");
+      $ret[] = update_sql("CREATE SEQUENCE {textimage_preset_pid_seq} INCREMENT 1 START 1;");
       break;
   }
   
@@ -99,4 +102,4 @@
   variable_del('textimage_image_margin');
   
   return $ret;
-}
\ No newline at end of file
+}
diff -urP textimage.orig/textimage.module textimage/textimage.module
--- textimage.orig/textimage.module	2007-01-23 03:10:34.000000000 +1300
+++ textimage/textimage.module	2007-04-26 23:59:23.000000000 +1200
@@ -172,11 +172,11 @@
     drupal_set_message(t('Textimage requires <a href="!path">clean URLs</a> be enabled. Without clean URL support Textimage is unable to cache images and can cause serious performance problems.', array('!path' => url('admin/settings/clean-urls'))), 'error');
   }
   //check for valid font path
-  if ($fonts_path != '' && !file_check_directory($fonts_path)) {
+  if ($fonts_path != '' && !is_dir($fonts_path)) {
     drupal_set_message(t('The current font path is invalid. The default font will be used.'), 'error');
   }
   //check for valid image path
-  if ($images_path != '' && !file_check_directory($images_path)) {
+  if ($images_path != '' && !is_dir($images_path)) {
     drupal_set_message(t('The current images path is invalid. No images will be used.'), 'error');
   }
 
@@ -241,10 +241,10 @@
 
 function textimage_settings_form_validate($form_id, $form_values) {
   //check for valid font path
-  if ($form_values['textimage_fonts_path'] !="" && !file_check_directory($form_values['textimage_fonts_path']))
+  if ($form_values['textimage_fonts_path'] !="" && !is_dir($form_values['textimage_fonts_path']))
     form_set_error('textimage_fonts_path', t('The entered font path is invalid'));
   //check for valid image path
-  if ($form_values['textimage_images_path'] !="" && !file_check_directory($form_values['textimage_images_path']))
+  if ($form_values['textimage_images_path'] !="" && !is_dir($form_values['textimage_images_path']))
     form_set_error('textimage_images_path', t('The entered image path is invalid'));
 }
 
