added conditions to update successfully.