Some fix to code for support LDAP on SSL and LDAP on TLS