Fix active directory

This pull request fixes 4 obvious defects found in the file lib/active_directory.
No test cases were included due to the difficulty in setting up a LDAP server, which is required to run this module.