bugfix: variable scope