diff --git a/recaptcha.module b/recaptcha.module
index eddf99f..b8d871a 100644
--- a/recaptcha.module
+++ b/recaptcha.module
@@ -141,7 +141,13 @@ function recaptcha_captcha() {
           $recaptcha_public_key .= '&nocookie=1';
         }
 
-        $html = recaptcha_get_html($recaptcha_public_key, NULL, $recaptcha_secure_connection);
+        if ($recaptcha_public_key && $recaptcha_secure_connection) {
+          $html = recaptcha_get_html($recaptcha_public_key, NULL, $recaptcha_secure_connection);
+        }
+        else {
+          return captcha_captcha('generate', 'Math', $args);
+        }
+
         $captcha['form']['captcha_response'] = array(
           '#type' => 'hidden',
           '#value' => 'reCAPTCHA',
