             
         // Make sure currentIndex is within range
         var inRows:Boolean = orientation == TileOrientation.ROWS;
-        var maxIndex:int = target.numElements - 1;
         currentIndex = Math.max(0, Math.min(maxIndex, currentIndex));
 
         // Find the current column and row

    /**
     *  @private 
     */  
    override public function getNavigationDestinationIndex(currentIndex:int, navigationUnit:uint):int
    {
        if (!target || target.numElements < 1)
            return -1; 
            
        // Special case when nothing was previously selected
        if (currentIndex == -1)
        {
            if (navigationUnit == NavigationUnit.UP || navigationUnit == NavigationUnit.LEFT)
                return -1;

            if (navigationUnit == NavigationUnit.DOWN || navigationUnit == NavigationUnit.RIGHT)
                return 0;    

                }
                break; 
            }
            default: return super.getNavigationDestinationIndex(currentIndex, navigationUnit, arrowKeysWrapFocus);
        }

        // Make sure rows and columns are within range
