     private function commitSelectedIndex():Boolean
     {
         // Step 1: make sure the proposed selected index is in range.
-        var maxIndex:int = numItems - 1;
+        var maxIndex:int = dataProvider.length - 1;
         var oldIndex:int = _selectedIndex;
         
         if (_proposedSelectedIndex < NO_SELECTION)
             _proposedSelectedIndex = NO_SELECTION;
         if (_proposedSelectedIndex > maxIndex)
             _proposedSelectedIndex = maxIndex;
-        if (requiresSelection && _proposedSelectedIndex == NO_SELECTION && numItems > 0)
+        if (requiresSelection && _proposedSelectedIndex == NO_SELECTION && dataProvider.length > 0)
             return false;
         
         // Step 2: dispatch the "selectionChanging" event. If preventDefault() is called

    	if (selectedIndex == NO_SELECTION)
    	   return undefined;
    	   
        return getItemAt(selectedIndex);
    }
    
    public function set selectedItem(value:*):void
    {
        selectedIndex = getItemIndex(value);
    }

    //----------------------------------

     *  @private
     *  Called when an item has been added to this component.
     */
    protected function itemAddedHandler(item:*, index:int):void
    {
        if (selectedIndex == NO_SELECTION || doingWholesaleChanges)
            return;
        
        // If an item is added before the selected item, bump up our
        // selected index backing variable. 
        if (index <= selectedIndex)
            adjustSelectedIndex(selectedIndex + 1);
    }
    
