diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 74224c151475dd1df9b391be577ba170bca1bc33..384aaff2c45734ecdf0398a1ff018c10cced71fd 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -600,7 +600,7 @@ class Net_LDAP3
             return false;
         }
 
-        if (is_resource($this->conn)) {
+        if (isset($this->conn) && $this->conn !== false) {
             $this->_debug("Connection already exists");
             return true;
         }
@@ -644,7 +644,7 @@ class Net_LDAP3
             $this->_debug("S: NOT OK");
         }
 
-        if (!is_resource($this->conn)) {
+        if (!isset($this->conn) || $this->conn === false) {
             $this->_error("Could not connect to LDAP");
             return false;
         }