Fixing some activedirectory bugs.