Problem scrolling through table view

This is my table view of books:

 

The colour of the text changes for each row that’s selected to show that it has been clicked on.

I get this error anytime I try to scroll through the table view:

Is there a way that I can scroll through the table view without touching any of the actual rows so I don’t have this problem?

Or any other suggestions?

Here’s code for the table view:

local function onRowRender( event ) local row = event.row local rowHeight = row.contentHeight local rowWidth = row.contentWidth local present = '' if (row.params.InLibrary == 0) then present = 'Checked out' else present = 'In Library' end local rowText = display.newText( row, row.params.AuthorLastName .. ' ' .. row.params.AuthorFirstName .. ' ' .. row.params.Title .. ' ' .. present, 0, 0, nil, 24 ) if has\_value(selected, row.params.ID) then rowText:setFillColor(0.7) else rowText:setFillColor(0) end rowText.anchorX = 0 rowText.x = 0 rowText.y = rowHeight \* 0.5 end local function onRowTouch( event ) local ind = {} local row = event.row if has\_value(selected, row.params.ID) then for k,v in ipairs(selected) do ind[v] = k end table.remove(selected, ind[row.params.ID]) else table.insert(selected, row.params.ID) end searchThisBook() end local tableView = widget.newTableView( { left = 50, top = 250, height = 400, width = 650, onRowTouch = onRowTouch, onRowRender = onRowRender, } )