Bug fix: wrong variable scope.