Fix for bug demonstrated in #1506. When we add variables as output of their defining scope, we need to propagate this information upwards to all parent scopes which are not current active.