my stab at fixing the non MT safety code in the LDAP lookup