diff --git a/nodejs.js b/nodejs.js
index b04b2d4..5201dcc 100644
--- a/nodejs.js
+++ b/nodejs.js
@@ -96,10 +96,10 @@ Drupal.Nodejs.connect = function () {
       // send sessionId for AJAX requests so we can exclude the current browser
       // window from resulting notifications. We do this so that modules can hook
       // in to other modules ajax requests without having to patch them.
-      Drupal.Nodejs.originalBeforeSerialize = Drupal.ajax.prototype.beforeSerialize;
+      Drupal.ajax.prototype.nodejsOriginalBeforeSerialize = Drupal.ajax.prototype.beforeSerialize;
       Drupal.ajax.prototype.beforeSerialize = function(element_settings, options) {
-        options.data['nodejs_client_socket_id'] = Drupal.Nodejs.socket.sessionid;
-        return Drupal.Nodejs.originalBeforeSerialize(element_settings, options);
+        options.data['nodejs_client_socket_id'] = Drupal.Nodejs.socket.socket.sessionid;
+        return this.nodejsOriginalBeforeSerialize(element_settings, options);
       };
     }
   });
