fix typo for variable scoping