Fix ldap, rework script