diff --git a/events.xml b/events.xml
index 8e2817694088f78049d407493b3ede8df7507910..97d3fbeecaadf72b49b8de4667ba635ee23d75a2 100644
--- a/events.xml
+++ b/events.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <events>
-    <event on="onSiteSave" fire="\QUI\Bricks\Events::onSiteSave" />
-    <event on="onSmartyInit" fire="\QUI\Bricks\Events::onSmartyInit" />
+    <event on="onSiteSave" fire="\QUI\Bricks\Events::onSiteSave"/>
+    <event on="onSmartyInit" fire="\QUI\Bricks\Events::onSmartyInit"/>
+    <event on="onPackageSetup" fire="\QUI\Bricks\Events::onPackageSetup"/>
 </events>
\ No newline at end of file
diff --git a/patches/uniqueIds.php b/patches/uniqueIds.php
new file mode 100644
index 0000000000000000000000000000000000000000..4a75145b79525218bcc6e15f65e364d4b4417c3f
--- /dev/null
+++ b/patches/uniqueIds.php
@@ -0,0 +1,71 @@
+<?php
+
+define('QUIQQER_SYSTEM', true);
+require dirname(dirname(dirname(dirname(__FILE__)))).'/header.php';
+
+// workaround for older patch
+$Bricks = QUI\Bricks\Manager::init();
+$result = QUI::getDataBase()->fetch(array(
+    'count' => 'count',
+    'from'  => $Bricks->getUIDTable(),
+));
+
+// if unique ids already exist, the pages no longer have to be passed through
+if (isset($result[0]) && isset($result[0]['count']) && $result[0]['count']) {
+    echo 'Already executed'.PHP_EOL;
+
+    return;
+}
+
+$projects = QUI::getProjectManager()->getProjectList();
+
+// helper to look if areas are empty
+$areasEmpty = function ($areas) {
+    if (!is_array($areas)) {
+        return true;
+    }
+
+    foreach ($areas as $area => $data) {
+        if (!empty($data)) {
+            return false;
+        }
+    }
+
+    return true;
+};
+
+echo PHP_EOL;
+
+/* @var $Project QUI\Projects\Project */
+foreach ($projects as $Project) {
+    $ids = $Project->getSitesIds();
+
+    foreach ($ids as $id) {
+        $id = $id['id'];
+
+        try {
+            $Site  = $Project->get($id);
+            $areas = $Site->getAttribute('quiqqer.bricks.areas');
+
+            if ($areas === false) {
+                continue;
+            }
+
+            $areas = json_decode($areas, true);
+
+            if ($areasEmpty($areas)) {
+                continue;
+            }
+
+            echo $Project->getName().'-'.$Project->getLang().'-'.$id.PHP_EOL;
+
+            $Edit = $Site->getEdit();
+            $Edit->save(QUI::getUsers()->getSystemUser());
+        } catch (QUI\Exception $Exception) {
+            continue;
+        }
+    }
+
+    unset($Edit);
+    unset($Project);
+}
diff --git a/src/QUI/Bricks/Events.php b/src/QUI/Bricks/Events.php
index 40ca687af82fff6639dc7d7fb721d09aa997eb1d..8c70aaed8922c101aa15e40744471368341a31cf 100644
--- a/src/QUI/Bricks/Events.php
+++ b/src/QUI/Bricks/Events.php
@@ -202,4 +202,14 @@ public static function brickarea($params, $smarty)
 
         return '';
     }
+
+    /**
+     * @param QUI\Package\Package $Package
+     */
+    public static function onPackageSetup(QUI\Package\Package $Package)
+    {
+        if ($Package->getName() !== 'quiqqer/bricks') {
+            return;
+        }
+    }
 }