Fix potential bugs in Variables preference pane

While looking around the code from my previous changes, I notice these two potential bugs. They are edge cases, particularly 873e585 (I doubt anyone actually deletes any of the default rows), but if encountered they do throw exceptions and can leave the table in an unusable state.