diff --git a/slideshow_creator.inc b/slideshow_creator.inc
index 807912d..763f34a 100644
--- a/slideshow_creator.inc
+++ b/slideshow_creator.inc
@@ -185,33 +185,44 @@ function _slideshow_creator_tagconversion(&$max_ss, &$attributes) {
         if (trim(drupal_strtolower($attribute[0])) == 'img') {
 	  // img tag: URL|link|title|caption|target format
           $img_attributes = explode('|', $attribute[1]);
-          if (!empty($img_attributes[1])) {
+	  foreach ($img_attributes as &$attr) {
+	    $attr = trim($attr);
+	  }
+	  unset($attr);  // remove the last reference to an array element.
+
+          if (isset($img_attributes[1]) and $img_attributes[1] != '') {
             $slides['#total']++;
-            $img_attributes[2] = trim($img_attributes[2]);
+            if (!isset($img_attributes[2])) {
+	      $img_attributes[2] = '';
+	    }
             $slides[$slides['#total']] = array(
               '#src'     => _slideshow_creator_url(check_url(trim(
-			 	    $img_attributes[1]
+				  $img_attributes[1]
 			 	))),
-              '#link'    => empty($img_attributes[2]) ?
-	                    '' :
-	                    _slideshow_creator_url(url($img_attributes[2])),
-              '#title'   => empty($img_attributes[3]) ?
-                            '' :
-                            preg_replace(
-			 	  '|\\\,|',
-			 	  ',',
-			 	  trim($img_attributes[3])
-			 	),
-              '#caption' => empty($img_attributes[4]) ?
-                            '' :
-                            preg_replace(
-			 	  '|\\\,|',
-			 	  ',',
-			 	  trim($img_attributes[4])
-			 	),
-              '#target'  => !empty($img_attributes[5]) ?
-	                    trim($img_attributes[5]) :
-                                '',
+              '#link'        => $img_attributes[2] == '' ?
+	                          '' :
+	                          _slideshow_creator_url(url(
+				    $img_attributes[2]
+				  )),
+              '#title'       => (!isset($img_attributes[3]) or
+				 $img_attributes[3] == '') ?
+                                   '' :
+                                   preg_replace(
+				     '|\\\,|',
+				     ',',
+				     $img_attributes[3]
+				   ),
+              '#caption'     => (!isset($img_attributes[4]) or
+				 $img_attributes[4] == '') ?
+                                   '' :
+                                   preg_replace(
+				     '|\\\,|',
+				     ',',
+				     $img_attributes[4]
+				   ),
+              '#target'      => !isset($img_attributes[5])?
+                                  '' :
+	                          $img_attributes[5],
             );
           }
         }
@@ -223,9 +234,10 @@ function _slideshow_creator_tagconversion(&$max_ss, &$attributes) {
 	  unset($attr);  // remove the last reference to an array element.
 
 	  // Get to a path with predictable '/' on both ends
-	  $dir_attributes[1] = trim($dir_attributes[1], ' /');
+	  $dir_attributes[1] = isset($dir_attributes[1]) ?
+	                         trim($dir_attributes[1], ' /') : '';
 	  // Add a separator '/' if not already present
-	  if (!empty($dir_attributes[1])) {
+	  if ($dir_attributes[1] != '') {
 	    $dir_attributes[1] = '/' . $dir_attributes[1] . '/';
 	  } else {
 	    $dir_attributes[1] = '/';
@@ -566,9 +578,9 @@ function theme_slideshow_creator($ss) {
  *   Array. The partial data array, extracted from the ssc tag
  */
 function _theme_slideshow_creator_content($ssid, &$ssc, &$ss) {
-  $title = !empty($ss['#title']) ? $ss['#title'] : '';
+  $title = isset($ss['#title']) ? $ss['#title'] : '';
 
-  if (!empty($ss['#src'])) {
+  if (isset($ss['#src']) and $ss['#src'] != '') {
     // Build the image
     $image = theme('image', $ss['#src'], check_plain($title),
 		   check_plain($title), NULL, FALSE);
@@ -576,12 +588,12 @@ function _theme_slideshow_creator_content($ssid, &$ssc, &$ss) {
     $image = preg_replace("/\"\/\//", '"/', $image);
 
     // Add a new image link
-    if (empty($ss['#link'])) {
-      $main = $image . "\n";
+    if ($ss['#link'] == '') {
+      $main = $image;
     }
     else {
       $ss['#link'] = preg_replace("/^\/\/?/", '', $ss['#link']);
-      if (empty($ss['#target'])) {
+      if ($ss['#target'] == '') {
 	$main = l($image, $ss['#link'], array('html' => TRUE));
       }
       else {
