diff --git a/bin/Site/Area.js b/bin/Site/Area.js
index 2f9d21092244de3c0439db566aaf43ba478275dd..91d41a6ca84e5184e2deb52588bdba040ef34f5a 100644
--- a/bin/Site/Area.js
+++ b/bin/Site/Area.js
@@ -828,6 +828,10 @@ define('package/quiqqer/bricks/bin/Site/Area', [
                                 data    = QUIFormUtils.getFormData(Form),
                                 brickId = Select.getParent().get('id');
 
+                            if (typeof self.$brickCustomData[brickId] === 'undefined') {
+                                self.$brickCustomData[brickId] = {};
+                            }
+
                             self.$brickCustomData[brickId].customfields = JSON.encode(data);
 
                             Win.close();
diff --git a/patches/uniqueIds.php b/patches/uniqueIds.php
index 047fa3f12886711423681f06e7168ced894bfb79..8b83912e559858f4473320e3a9c5cec5db1856e4 100644
--- a/patches/uniqueIds.php
+++ b/patches/uniqueIds.php
@@ -1,6 +1,7 @@
 <?php
 
 define('QUIQQER_SYSTEM', true);
+define('SYSTEM_INTERN', true);
 require dirname(dirname(dirname(dirname(__FILE__)))).'/header.php';
 
 // workaround for older patch
@@ -11,7 +12,7 @@
 ));
 
 // 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']) {
+if (false && isset($result[0]) && isset($result[0]['count']) && $result[0]['count']) {
     echo 'Already executed'.PHP_EOL;
 
     return;
@@ -44,7 +45,7 @@
         $id = $id['id'];
 
         try {
-            $Site  = $Project->get($id);
+            $Site  = new QUI\Projects\Site\Edit($Project, $id);
             $areas = $Site->getAttribute('quiqqer.bricks.areas');
 
             if ($areas === false) {
@@ -59,10 +60,11 @@
 
             echo $Project->getName().'-'.$Project->getLang().'-'.$id.PHP_EOL;
 
-            $Edit = $Site->getEdit();
-            $Edit->load();
-            $Edit->save(QUI::getUsers()->getSystemUser());
+            $Site->unlockWithRights();
+            $Site->load();
+            $Site->save(QUI::getUsers()->getSystemUser());
         } catch (QUI\Exception $Exception) {
+            echo $Exception->getMessage().PHP_EOL;
             continue;
         }
     }
@@ -70,3 +72,23 @@
     unset($Edit);
     unset($Project);
 }
+
+echo 'Bricks saving...';
+
+// alle bausteine speichern
+$bricks = QUI::getDataBase()->fetch(array(
+    'from' => $Bricks->getTable()
+));
+
+foreach ($bricks as $brick) {
+    try {
+        $Brick = $Bricks->getBrickById($brick['id']);
+        $Bricks->saveBrick($brick['id'], $Brick->getAttributes());
+    } catch (QUI\Exception $Exception) {
+        QUI\System\Log::writeException($Exception);
+        echo $Exception->getMessage().PHP_EOL;
+    }
+}
+
+echo '[done]';
+echo PHP_EOL;
diff --git a/src/QUI/Bricks/Events.php b/src/QUI/Bricks/Events.php
index 8c70aaed8922c101aa15e40744471368341a31cf..9e2cc208c39d860c6f9f7b3ce87141ad4b4ab4ea 100644
--- a/src/QUI/Bricks/Events.php
+++ b/src/QUI/Bricks/Events.php
@@ -17,6 +17,8 @@
  */
 class Events
 {
+    protected static $saved = array();
+
     /**
      * Event : on site save
      * Create site brick cache, for inheritance
@@ -25,6 +27,10 @@ class Events
      */
     public static function onSiteSave($Site)
     {
+        if (isset(self::$saved[$Site->getId()])) {
+            return;
+        }
+
         QUI\Permissions\Permission::checkPermission('quiqqer.bricks.assign');
 
         $areas = $Site->getAttribute('quiqqer.bricks.areas');
@@ -146,6 +152,8 @@ public static function onSiteSave($Site)
             ));
         }
 
+        self::$saved[$Site->getId()] = true;
+
         // save bricks with unique ids
         $Site->setAttribute('quiqqer.bricks.areas', json_encode($areas));
         $Site->save();
diff --git a/src/QUI/Bricks/Manager.php b/src/QUI/Bricks/Manager.php
index 8ef9e309b2314a3ae0765fb3fd46ae15dc5f7ab1..851fe95f56f6e22d6c882e907cf34ad8eef170d2 100644
--- a/src/QUI/Bricks/Manager.php
+++ b/src/QUI/Bricks/Manager.php
@@ -470,7 +470,15 @@ public function getBrickByUID($uid)
         $attributes = $data['attributes'];
         $attributes = json_decode($attributes, true);
 
-        $Original = new Brick($attributes);
+        $real = QUI::getDataBase()->fetch(array(
+            'from'  => $this->getTable(),
+            'where' => array(
+                'id' => (int)$brickId
+            ),
+            'limit' => 1
+        ));
+
+        $Original = new Brick($real[0]);
         $Original->setAttribute('id', $brickId);
 
         $Clone = clone $Original;
@@ -838,7 +846,7 @@ public function saveBrick($brickId, array $brickData)
      *
      * @return String
      */
-    protected function getTable()
+    public static function getTable()
     {
         return QUI::getDBTableName(self::TABLE);
     }