         sort.fields = [];
         var oddDescending:Boolean = false;
         
-        var n:int = columns.length;
+        var n:int = _columns.length;
         for (var i:int = 0; i < n; i++)
         {
             sort.fields.push(


        // If column becomes hidden, invalidate anchor, highlight and selected indices.
        {
            if (anchorColumnIndex != -1 && columns[anchorColumnIndex].visible == false)
                anchorColumnIndex = -1;
            if (highlightColumnIndex != -1 && columns[highlightColumnIndex].visible == false)
                highlightColumnIndex = -1;
            if (selectedColumnIndex != -1 && columns[selectedColumnIndex].visible == false)
                selectedColumnIndex = -1;
        }
    }

          {
              if (sortableColumns && 
                  selectedHeaderInfo.column.colNum != -1 && !isNaN(selectedHeaderInfo.column.colNum)
                  && _columns[selectedHeaderInfo.column.colNum].sortable)
              {
                  isKeyPressed = true;
                  selectColumnHeader(selectedHeaderInfo.column.colNum);
