fixed non-determinism in rules for external defs and anonymous scopes