Did some modification for contingent winldap support.