fixed variable scoping