Fix the bug where the last cell was not being updated correctly