fix bug in variable scoping