fixing scope issues