simplified some logic in LDAP