fixed scope issues

@jtfairbank