Fix students table integrity bug

Fix bug that happens when editing a cell and the table is sorted the
wrong value can get changed when saving the table