diff --git a/core/misc/batch.js b/core/misc/batch.js
index b83776d..9f876cb 100644
--- a/core/misc/batch.js
+++ b/core/misc/batch.js
@@ -1,4 +1,4 @@
-(function ($) {
+(function ($, Drupal) {
 
 "use strict";
 
@@ -7,9 +7,9 @@
  */
 Drupal.behaviors.batch = {
   attach: function (context, settings) {
-    $(context).find('#progress').once('batch', function () {
-      var holder = $(this);
-
+    var holder = $(this);
+    var $progress = $('#progress').once('batch');
+    if ($progress.length) {
       // Success: redirect to the summary.
       var updateCallback = function (progress, status, pb) {
         if (progress == 100) {
@@ -23,12 +23,12 @@ Drupal.behaviors.batch = {
         $('#wait').hide();
       };
 
-      var progress = new Drupal.progressBar('updateprogress', updateCallback, 'POST', errorCallback);
-      progress.setProgress(-1, settings.batch.initMessage);
-      holder.append(progress.element);
-      progress.startMonitoring(settings.batch.uri + '&op=do', 10);
-    });
+      var progressBar = new Drupal.progressBar('updateprogress', updateCallback, 'POST', errorCallback);
+      progressBar.setProgress(-1, settings.batch.initMessage);
+      holder.append(progressBar.element);
+      progressBar.startMonitoring(settings.batch.uri + '&op=do', 10);
+    }
   }
 };
 
-})(jQuery);
+})(jQuery, Drupal);
