diff --git a/www/api/class/centreon_realtime_hosts.class.php b/www/api/class/centreon_realtime_hosts.class.php
index e12bd091871dfbee3d32e94eadb16d1ecff011c8..da12e90a8dcf87611fe43a96481395344f8bcb9b 100644
--- a/www/api/class/centreon_realtime_hosts.class.php
+++ b/www/api/class/centreon_realtime_hosts.class.php
@@ -406,8 +406,9 @@ class CentreonRealtimeHosts extends CentreonRealtimeBase
         $query .= " AND h.enabled = 1 ";
 
         if (
-            in_array($this->sortType, explode(',', $this->arguments['fields'])) ||
-            is_null($this->arguments['fields'])
+            !isset($this->arguments['fields']) ||
+            is_null($this->arguments['fields']) ||
+            in_array($this->sortType, explode(',', $this->arguments['fields']))
         ) {
             $q = 'ASC';
             if (isset($this->order) && strtoupper($this->order) === 'DESC') {
diff --git a/www/class/centreonHostgroups.class.php b/www/class/centreonHostgroups.class.php
index dbb907bce311f015193dc711addbe330e0a95c56..0fb51424548558070887e7c6ccea5fe92a26784d 100644
--- a/www/class/centreonHostgroups.class.php
+++ b/www/class/centreonHostgroups.class.php
@@ -373,7 +373,7 @@ class CentreonHostgroups
             $hostList[] = array(
                 'host' => $elem['host_name'],
                 'host_id' => $elem['host_id'],
-                'hg_name' => $elem[$hgName]
+                'hg_name' => $hgName
             );
         }
 
diff --git a/www/class/centreonInstance.class.php b/www/class/centreonInstance.class.php
index fc77cbb4612754918395ab79643d5a8e3497787c..8363bc95b5584d055620cd95006a48734d35807a 100644
--- a/www/class/centreonInstance.class.php
+++ b/www/class/centreonInstance.class.php
@@ -271,7 +271,7 @@ class CentreonInstance
         while ($elem = $result->fetchrow()) {
             $instanceList[] = array(
                 'host' => $elem['host_name'],
-                'name' => $elem['instance_name']
+                'name' => $instanceName
             );
         }
 
diff --git a/www/class/centreonServicegroups.class.php b/www/class/centreonServicegroups.class.php
index df14efa2c85dd3cf4b585fca940b5afca9d6d9aa..8b0c709e64df0f9b26ce5d63f1b5468cfd1c38ab 100644
--- a/www/class/centreonServicegroups.class.php
+++ b/www/class/centreonServicegroups.class.php
@@ -263,7 +263,7 @@ class CentreonServicegroups
                 'service' => $elem['service_description'],
                 'service_id' => $elem['service_id'],
                 'host' => $elem['host_name'],
-                'sg_name' => $elem[$sgName]
+                'sg_name' => $sgName
             );
         }