update word order after edit

This re-sorts the word table after an edit or a delete. It also fixes a couple of exceptions if edit or delete buttons are clicked when no word is selected.