Acl tokensubstitution fixes

refer commit messages for a description of the bugs fixed