fix bug in spreadsheet update logic.