fixed AD mapping scripts and related issues