Add defensive codes for edit methods