Instantiate scopes correctly in result p-code and ensure that variable settings aren't attempted before the corresponding scope is in place. This fixes [bug 3478 (#3478)]. Rev: server/etc/modules/RXML.pmod/module.pmod:1.316