Fixes scope issues