diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 511cee34d628b0442e5a6ab71c85de8da5879210..d83d1e8b1a505fb2f6391cd0dca115858c0257bf 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -659,7 +659,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
  */
 function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0)
 {
-	global $conf;
+	global $conf,$langs;
 
 	$out="\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
 
@@ -749,8 +749,6 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
 		$displaytab=$i;
 	}
 
-	$out.="</div>\n";
-
 	if ($displaytab > $limittoshow)
 	{
 		$out.='<div id="moretabs" class="inline-block tabsElem">';
@@ -764,6 +762,8 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
 		$out.="</script>";
 	}
 
+	$out.="</div>\n";
+
 	if (! $notab) $out.="\n".'<div class="tabBar">'."\n";
 
 	return $out;