diff --git a/CHANGELOG.md b/CHANGELOG.md
index c5f127031d8cb87e1e289f4a59695190ba9a8e3d..52af433ac37e60835be195f7baa74b0584da30c7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
+## Version 1.3
+* allow edit of Pack ID
+* fix error -> duplicate Pack ID when adding consent activity link
+
 ## Version 1.2
 * fix error with empty panel and pack links when saving consent
-*
+
 ## Version 1.1
 * fixed comments from first prototype and discussion 6 Jan 2023 (see https://www.wrike.com/open.htm?id=886793367)
 
diff --git a/CRM/Nbrpanelconsentpack/BAO/ConsentPackLink.php b/CRM/Nbrpanelconsentpack/BAO/ConsentPackLink.php
index 64c8c9b8b61009dcc83b54c4559f81e0e2ad0422..75426e898fb36ea6f5fff5a76af296445fc02dde 100644
--- a/CRM/Nbrpanelconsentpack/BAO/ConsentPackLink.php
+++ b/CRM/Nbrpanelconsentpack/BAO/ConsentPackLink.php
@@ -48,15 +48,17 @@ class CRM_Nbrpanelconsentpack_BAO_ConsentPackLink extends CRM_Nbrpanelconsentpac
    */
   public static function hasContactIdentityForPackId(?int $contactId, string $packId): bool {
     if ($packId && $contactId) {
+      $identityTypes = self::getPackIdentifierTypes();
       try {
-        $contactIdentities = \Civi\Api4\CustomValue::get('contact_id_history')
+        $api = \Civi\Api4\CustomValue::get('contact_id_history')
           ->addSelect('*')
           ->addWhere('entity_id', '=', $contactId)
-          ->addWhere('id_history_entry_type:name', '=', self::getPackIdentifierTypes())
           ->addWhere('id_history_entry', '=', $packId)
-          ->setLimit(1)
-          ->execute();
-        $count = $contactIdentities->count();
+          ->setLimit(1);
+        if (!empty($identityTypes)) {
+          $api->addWhere('id_history_entry_type:name', 'IN', $identityTypes);
+        }
+        $count = $api->execute()->count();
         if ($count > 0) {
           return TRUE;
         }
@@ -77,7 +79,7 @@ class CRM_Nbrpanelconsentpack_BAO_ConsentPackLink extends CRM_Nbrpanelconsentpac
     try {
       $optionValues = \Civi\Api4\OptionValue::get()
         ->addSelect('name')
-        ->addWhere('option_group_id', '=', Civi::service('nbrBackbone')->getContactIdentityCustomGroupId())
+        ->addWhere('option_group_id:name', '=', "contact_id_history_type")
         ->addWhere('name', 'LIKE', '%pack%')
         ->execute();
       foreach ($optionValues as $optionValue) {
@@ -88,7 +90,7 @@ class CRM_Nbrpanelconsentpack_BAO_ConsentPackLink extends CRM_Nbrpanelconsentpac
     }
     catch (API_Exception $ex) {
     }
-    return $types;
+   return $types;
   }
 
   /**
diff --git a/CRM/Nbrpanelconsentpack/Form/PackId.php b/CRM/Nbrpanelconsentpack/Form/PackId.php
index 1e863a6588b9214c8bdb17397862002215d142eb..8341012139fb0edfd8aef8478ca0d115bd31f810 100644
--- a/CRM/Nbrpanelconsentpack/Form/PackId.php
+++ b/CRM/Nbrpanelconsentpack/Form/PackId.php
@@ -171,7 +171,6 @@ class CRM_Nbrpanelconsentpack_Form_PackId extends CRM_Core_Form {
    * @return string[]|true
    */
   public static function validatePanelLinks(array $fields) {
-    $errors = [];
     if ($fields['panel_links']) {
       if (empty($fields['consent_activity_id'])) {
         return ['consent_activity_id' => "You can only add links to panel-centre-site-source if the pack ID is linked to a consent activity."];
@@ -219,6 +218,7 @@ class CRM_Nbrpanelconsentpack_Form_PackId extends CRM_Core_Form {
     if ($this->_action == CRM_Core_Action::UPDATE) {
       $this->updateConsentPanelPackLinks();
     }
+    $this->ajaxResponse['updateTabs']['#tab_nbr_pack_id'] = 1;
     parent::postProcess();
   }
   /**
@@ -231,11 +231,13 @@ class CRM_Nbrpanelconsentpack_Form_PackId extends CRM_Core_Form {
       CRM_Nbrpanelconsentpack_BAO_ConsentPackLink::updateContactIdentityForPackId($this->_contactId, $this->_packId, $this->_defaultValues['pack_id']);
     }
     // if link to consent activity or panels, update link
-    if ($this->_submitValues['consent_activity_id'] && !$this->_defaultValues['consent_activity_id']) {
-      CRM_Nbrpanelconsentpack_BAO_ConsentPackLink::createPackLink((int) $this->_submitValues['consent_activity_id'], $this->_contactId, $this->_packId);
-      CRM_Core_Session::setStatus("Link between Pack ID and Consent Activity saved", "Saved", "success");
+    if ($this->_submitValues['consent_activity_id']) {
+      if (!isset($this->_defaultValues['consent_activity_id']) || empty($this->_defaultValues['consent_activity_id'])) {
+        CRM_Nbrpanelconsentpack_BAO_ConsentPackLink::createPackLink((int) $this->_submitValues['consent_activity_id'], $this->_contactId, $this->_packId);
+        CRM_Core_Session::setStatus("Link between Pack ID and Consent Activity saved", "Saved", "success");
+      }
     }
-    elseif ($this->_submitValues['consent_activity_id'] && $this->_defaultValues['consent_activity_id'] && $this->_submitValues['consent_activity_id'] != $this->_defaultValues['consent_activity_id']) {
+    elseif ($this->_submitValues['consent_activity_id'] && isset($this->_defaultValues['consent_activity_id']) && $this->_submitValues['consent_activity_id'] != $this->_defaultValues['consent_activity_id']) {
       CRM_Nbrpanelconsentpack_BAO_ConsentPackLink::updatePackLink((int) $this->_submitValues['consent_activity_id'], $this->_contactId, $this->_packId, $this->_defaultValues['consent_activity_id']);
       CRM_Core_Session::setStatus("Link between Pack ID and Consent Activity updated", "Saved", "success");
     }
diff --git a/info.xml b/info.xml
index 492e7910b3659dd43d00050588c485502f09c6b2..7d8a21817634f48e34c492db7ca01bf441b49671 100644
--- a/info.xml
+++ b/info.xml
@@ -14,8 +14,8 @@
     <url desc="Support">https://civicoop.org</url>
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
-  <releaseDate>2023-03-06</releaseDate>
-  <version>1.2</version>
+  <releaseDate>2023-04-03</releaseDate>
+  <version>1.3</version>
   <develStage>beta</develStage>
   <compatibility>
     <ver>5.0</ver>
diff --git a/nbrpanelconsentpack.php b/nbrpanelconsentpack.php
index 81ccc66daf5bea4997a6830ae42c4b84963ff6c3..2d710bbb08c884c5e6b7bf4b0da977053871daa3 100644
--- a/nbrpanelconsentpack.php
+++ b/nbrpanelconsentpack.php
@@ -27,6 +27,7 @@ function nbrpanelconsentpack_civicrm_postProcess($formName, $form) {
       if (CRM_Nbrpanelconsentpack_Utils::isValidActivityType($activityTypeId)) {
         CRM_Nbrpanelconsentpack_BAO_ConsentPanelLink::savePanelLinks($form);
         CRM_Nbrpanelconsentpack_BAO_ConsentPackLink::savePackLinks($form);
+        $form->ajaxResponse['updateTabs']['#tab_nbr_pack_id'] = 1;
       }
     }
   }