fixing more scoping issues