Critical scoping bug fix applied to 0.7 branch.