Fixed issue with variable scope.