Kinnison kinnison/fix ldap warnings

Incorporated the changes by @Kinnison and fixed a bug while doing so.