--- image_captcha/image_captcha.user.inc.orig	2008-06-04 10:20:01.000000000 +0200
+++ image_captcha/image_captcha.user.inc	2008-07-14 03:08:50.000000000 +0200
@@ -16,11 +16,10 @@
     return;
   }
   // get the code to draw from $_SESSION
-  $code = $_SESSION['image_captcha'][$seed];
-  // unset the code from $_SESSION to prevent rerendering the CAPTCHA
-  unset($_SESSION['image_captcha'][$seed]);
-  // only generate an image if there is an code
-  if ($code) {
+  // only generate captcha if code exists
+  if (isset($code = $_SESSION['image_captcha'][$seed])) {
+    // unset the code from $_SESSION to prevent rerendering the CAPTCHA
+    unset($_SESSION['image_captcha'][$seed]);
     // generate the image
     $image = @_image_captcha_generate_image($code);
     // check of generation was successful
