fix bugs for ldap plugin
fixes issue #1