diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php
index 740a5c978790c044d5bfb9841dd36468eb79c8d4..088f96b00c1c2716a8f1764cafb57a3b9605f6c4 100644
--- a/htdocs/adherents/admin/public.php
+++ b/htdocs/adherents/admin/public.php
@@ -215,7 +215,12 @@ dol_fiche_end();
 print '<br>';
 //print $langs->trans('FollowingLinksArePublic').'<br>';
 print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
-print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php">'.DOL_MAIN_URL_ROOT.'/public/members/new.php</a>';
+if ($conf->multicompany->enabled) {
+	$entity_qr='?entity='.$conf->entity;
+} else {
+	$entity_qr='';
+}
+print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
 
 /*
 print '<table class="border" cellspacing="0" cellpadding="3">';
diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php
index ba7f4cd3f907ca699e0f41e261cdeb8a550230e4..ca79c21e9ef852f57e57257ce9c7f776d66b8f36 100644
--- a/htdocs/core/lib/json.lib.php
+++ b/htdocs/core/lib/json.lib.php
@@ -251,7 +251,9 @@ function dol_json_decode($json, $assoc=false)
 		if (! empty($array))
 		{
 			$object = false;
-
+			if (count($array)>0) {
+				$object = (object) array();
+			}
 			foreach ($array as $key => $value)
 			{
 				if ($key) $object->{$key} = $value;
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 8fbd48bc85577a07bab922cc27a33fa4db368f31..cd8377ca5a8b46859a68474f1b38a39e076d950f 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -660,7 +660,7 @@ if (! defined('NOLOGIN'))
             $cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
 
             $entityCookie = new DolCookie($cryptkey);
-            $entityCookie->_setCookie($entityCookieName, $entity, $ttl);
+            $entityCookie->setCookie($entityCookieName, $entity, $ttl);
         }
 
         // Hooks on successfull login