BUG: Fix variable scope.