changed update to take into account deleted records when updating.