diff --git a/IPython/html/static/notebook/js/widgetmanager.js b/IPython/html/static/notebook/js/widgetmanager.js
index c8a5fb5..2526640 100644
--- a/IPython/html/static/notebook/js/widgetmanager.js
+++ b/IPython/html/static/notebook/js/widgetmanager.js
@@ -38,8 +38,8 @@
 
             // Register already-registered widget model types with the comm manager.
             var that = this;
-            _.each(WidgetManager._model_types, function(value, key) {
-                that.comm_manager.register_target(value, $.proxy(that._handle_comm_open, that));
+            _.each(WidgetManager._model_types, function(model_type, model_name) {
+                that.comm_manager.register_target(model_name, $.proxy(that._handle_comm_open, that));
             });
         };
 
diff --git a/IPython/html/static/notebook/js/widgets/widget.js b/IPython/html/static/notebook/js/widgets/widget.js
index f4cf76a..7a8a2aa 100644
--- a/IPython/html/static/notebook/js/widgets/widget.js
+++ b/IPython/html/static/notebook/js/widgets/widget.js
@@ -86,12 +86,13 @@ function(WidgetManager, Underscore, Backbone){
 
         apply_update: function (state) {
             // Handle when a widget is updated via the python side.
+            var that = this;
             _.each(state, function(value, key) {
-                this.key_value_lock = [key, value];
+                that.key_value_lock = [key, value];
                 try {
-                    this.set(key, this._unpack_models(value));
+                    that.set(key, that._unpack_models(value));
                 } finally {
-                    this.key_value_lock = null;
+                    that.key_value_lock = null;
                 }
             });
         },
@@ -154,7 +155,7 @@ function(WidgetManager, Underscore, Backbone){
             }
 
             // Only sync if there are attributes to send to the back-end.
-            if (attr.length > 0) {
+            if (_.size(attrs) > 0) {
                 var callbacks = options.callbacks || {};
                 if (this.pending_msgs >= this.msg_throttle) {
                     // The throttle has been exceeded, buffer the current msg so
@@ -203,8 +204,9 @@ function(WidgetManager, Underscore, Backbone){
                 return value.id;
             } else if (value instanceof Object) {
                 var packed = {};
+                var that = this;
                 _.each(value, function(sub_value, key) {
-                    packed[key] = this._pack_models(sub_value);
+                    packed[key] = that._pack_models(sub_value);
                 });
                 return packed;
             } else {
@@ -216,8 +218,9 @@ function(WidgetManager, Underscore, Backbone){
             // Replace model ids with models recursively.
             if (value instanceof Object) {
                 var unpacked = {};
+                var that = this;
                 _.each(value, function(sub_value, key) {
-                    unpacked[key] = this._unpack_models(sub_value);
+                    unpacked[key] = that._unpack_models(sub_value);
                 });
                 return unpacked;
             } else {
@@ -366,9 +369,10 @@ function(WidgetManager, Underscore, Backbone){
      
             var css = this.model.get('_css');
             if (css === undefined) {return;}
+            var that = this;
             _.each(css, function(css_traits, selector){
                 // Apply the css traits to all elements that match the selector.
-                var elements = this._get_selector_element(selector);
+                var elements = that._get_selector_element(selector);
                 if (elements.length > 0) {
                     _.each(css_traits, function(css_value, css_key){
                         elements.css(css_key, css_value);
diff --git a/IPython/html/static/notebook/js/widgets/widget_float.js b/IPython/html/static/notebook/js/widgets/widget_float.js
index 8485336..1c98e50 100644
--- a/IPython/html/static/notebook/js/widgets/widget_float.js
+++ b/IPython/html/static/notebook/js/widgets/widget_float.js
@@ -50,10 +50,11 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
                 // JQuery slider option keys.  These keys happen to have a
                 // one-to-one mapping with the corrosponding keys of the model.
                 var jquery_slider_keys = ['step', 'max', 'min', 'disabled'];
+                var that = this;
                 _.each(jquery_slider_keys, function(key, i) {
-                    var model_value = this.model.get(key);
+                    var model_value = that.model.get(key);
                     if (model_value !== undefined) {
-                        this.$slider.slider("option", key, model_value);
+                        that.$slider.slider("option", key, model_value);
                     }
                 });
 
diff --git a/IPython/html/static/notebook/js/widgets/widget_int.js b/IPython/html/static/notebook/js/widgets/widget_int.js
index af0c3c7..42b779f 100644
--- a/IPython/html/static/notebook/js/widgets/widget_int.js
+++ b/IPython/html/static/notebook/js/widgets/widget_int.js
@@ -49,10 +49,11 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
                 // JQuery slider option keys.  These keys happen to have a
                 // one-to-one mapping with the corrosponding keys of the model.
                 var jquery_slider_keys = ['step', 'max', 'min', 'disabled'];
+                var that = this;
                 _.each(jquery_slider_keys, function(key, i) {
-                    var model_value = this.model.get(key);
+                    var model_value = that.model.get(key);
                     if (model_value !== undefined) {
-                        this.$slider.slider("option", key, model_value);
+                        that.$slider.slider("option", key, model_value);
                     }
                 });
 
diff --git a/IPython/html/static/notebook/js/widgets/widget_selection.js b/IPython/html/static/notebook/js/widgets/widget_selection.js
index fab10c0..570aa3b 100644
--- a/IPython/html/static/notebook/js/widgets/widget_selection.js
+++ b/IPython/html/static/notebook/js/widgets/widget_selection.js
@@ -67,10 +67,11 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
                 var items = this.model.get('values');
                 var $replace_droplist = $('<ul />')
                     .addClass('dropdown-menu');
+                var that = this;
                 _.each(items, function(item, i) {
                     var item_button = $('<a href="#"/>')
                         .text(item)
-                        .on('click', $.proxy(this.handle_click, this));
+                        .on('click', $.proxy(that.handle_click, that));
                     $replace_droplist.append($('<li />').append(item_button));
                 });
 
@@ -140,20 +141,21 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
                 // Add missing items to the DOM.
                 var items = this.model.get('values');
                 var disabled = this.model.get('disabled');
+                var that = this;
                 _.each(items, function(item, index) {
                     var item_query = ' :input[value="' + item + '"]';
-                    if (this.$el.find(item_query).length === 0) {
+                    if (that.$el.find(item_query).length === 0) {
                         var $label = $('<label />')
                             .addClass('radio')
                             .text(item)
-                            .appendTo(this.$container);
+                            .appendTo(that.$container);
                         
                         $('<input />')
                             .attr('type', 'radio')
-                            .addClass(this.model)
+                            .addClass(that.model)
                             .val(item)
                             .prependTo($label)
-                            .on('click', $.proxy(this.handle_click, this));
+                            .on('click', $.proxy(that.handle_click, that));
                     }
                     
                     var $item_element = this.$container.find(item_query);
@@ -230,15 +232,16 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
                 // Add missing items to the DOM.
                 var items = this.model.get('values');
                 var disabled = this.model.get('disabled');
+                var that = this;
                 _.each(items, function(item, index) {
                    var item_query = ' :contains("' + item + '")';
-                    if (this.$buttongroup.find(item_query).length === 0) {
+                    if (that.$buttongroup.find(item_query).length === 0) {
                         $('<button />')
                             .attr('type', 'button')
                             .addClass('btn')
                             .text(item)
-                            .appendTo(this.$buttongroup)
-                            .on('click', $.proxy(this.handle_click, this));
+                            .appendTo(that.$buttongroup)
+                            .on('click', $.proxy(that.handle_click, that));
                     }
                     
                     var $item_element = this.$buttongroup.find(item_query);
@@ -314,14 +317,15 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
             if (options === undefined || options.updated_view != this) {
                 // Add missing items to the DOM.
                 var items = this.model.get('values');
+                var that = this;
                 _.each(items, function(item, index) {
                    var item_query = ' :contains("' + item + '")';
-                    if (this.$listbox.find(item_query).length === 0) {
+                    if (that.$listbox.find(item_query).length === 0) {
                         $('<option />')
                             .text(item)
                             .attr('value', item)
-                            .appendTo(this.$listbox)
-                            .on('click', $.proxy(this.handle_click, this));
+                            .appendTo(that.$listbox)
+                            .on('click', $.proxy(that.handle_click, that));
                     } 
                 });
 
diff --git a/IPython/html/static/notebook/js/widgets/widget_selectioncontainer.js b/IPython/html/static/notebook/js/widgets/widget_selectioncontainer.js
index 283378f..ee33811 100644
--- a/IPython/html/static/notebook/js/widgets/widget_selectioncontainer.js
+++ b/IPython/html/static/notebook/js/widgets/widget_selectioncontainer.js
@@ -39,8 +39,9 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
             if (options === undefined || options.updated_view != this) {
                 // Set tab titles
                 var titles = this.model.get('_titles');
+                var that = this;
                 _.each(titles, function(title, page_index) {
-                    var accordian = this.containers[page_index];
+                    var accordian = that.containers[page_index];
                     if (accordian !== undefined) {
                         accordian
                             .find('.accordion-heading')
@@ -216,8 +217,9 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
             if (options === undefined || options.updated_view != this) {
                 // Set tab titles
                 var titles = this.model.get('_titles');
+                var that = this;
                 _.each(titles, function(title, page_index) {
-                   var tab_text = this.containers[page_index];
+                   var tab_text = that.containers[page_index];
                     if (tab_text !== undefined) {
                         tab_text.text(title);
                     } 
diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py
index 4e399f3..151e0cf 100644
--- a/IPython/html/widgets/widget.py
+++ b/IPython/html/widgets/widget.py
@@ -80,7 +80,12 @@ class CallbackDispatcher(LoggingConfigurable):
         """Gets the number of arguments in a callback"""
         if callable(callback):
             argspec = inspect.getargspec(callback)
-            nargs = len(argspec[1]) # Only count vargs!
+            if argspec[0] is None:
+                nargs = 0
+            elif argspec[3] is None:
+                nargs = len(argspec[0]) # Only count vargs!
+            else:
+                nargs = len(argspec[0]) - len(argspec[3]) # Subtract number of defaults.
 
             # Bound methods have an additional 'self' argument
             if isinstance(callback, types.MethodType):