fixed more scope issues