fixed bugs after deleting rows from UI