diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index d0672378c1..ab40fbd04b 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 7.0NG.755-210705
+Version: 7.0NG.755-210709
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index f63507cd77..fec1cffea0 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.755-210705"
+pandora_version="7.0NG.755-210709"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 0c3ddebcb4..4469a14c51 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1015,7 +1015,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '7.0NG.755';
-use constant AGENT_BUILD => '210705';
+use constant AGENT_BUILD => '210709';
 
 # Agent log default file size maximum and instances
 use constant DEFAULT_MAX_LOG_SIZE => 600000;
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 964b4d14e2..1c6c1265cb 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.755
-%define release     210705
+%define release     210709
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 07a5f76692..c0e3bfa4ca 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.755
-%define release     210705
+%define release     210709
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer
index ef5923f9a8..3be5cc8851 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.755"
-PI_BUILD="210705"
+PI_BUILD="210709"
 OS_NAME=`uname -s`
 
 FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 0bdfd88e15..876cec7ec0 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{210705}
+{210709}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 8459f6597c..f1795fe51b 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("7.0NG.755 Build 210705")
+#define PANDORA_VERSION ("7.0NG.755 Build 210709")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 40bd2b8785..8b0b7e0d3c 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(7.0NG.755(Build 210705))"
+      VALUE "ProductVersion", "(7.0NG.755(Build 210709))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index de4e72b229..55d0472a14 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 7.0NG.755-210705
+Version: 7.0NG.755-210709
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index 5f4c49d6bf..eb08b54b83 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.755-210705"
+pandora_version="7.0NG.755-210709"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/extras/mr/48.sql b/pandora_console/extras/mr/48.sql
index b7c3307220..2671f7ff9e 100644
--- a/pandora_console/extras/mr/48.sql
+++ b/pandora_console/extras/mr/48.sql
@@ -37,4 +37,6 @@ UPDATE `tuser_task_scheduled` SET
 
 UPDATE `tconfig` SET `centralized_management` = 0;
 
+DELETE ta FROM `tagente` ta LEFT JOIN `tgrupo` tg on ta.`id_grupo` = tg.`id_grupo` WHERE tg.`id_grupo` IS NULL;
+
 COMMIT;
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 5220cd0315..2c982f781a 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
 /**
  * Pandora build version and version
  */
-$build_version = 'PC210705';
+$build_version = 'PC210709';
 $pandora_version = 'v7.0NG.755';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index 6b6092b0a7..8f9791332f 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -251,6 +251,13 @@ function agents_create_agent(
         return false;
     }
 
+    if (has_metaconsole() === true
+        && (bool) $config['metaconsole_agent_cache'] === true
+    ) {
+        // Force an update of the agent cache.
+        $values['update_module_count'] = 1;
+    }
+
     $id_agent = db_process_sql_insert('tagente', $values);
     if ($id_agent === false) {
         return false;
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 05cb091487..96166b0bbc 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -3984,7 +3984,7 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
         'plugin_pass'           => $other['data'][24],
         'plugin_parameter'      => $other['data'][25],
         'disabled_types_event'  => $disabled_types_event,
-        'macros'                => base64_decode($other['data'][27]),
+        'macros'                => base64_decode(str_replace('&#x20', '+', $other['data'][27])),
         'module_macros'         => $other['data'][28],
         'each_ff'               => $other['data'][29],
         'min_ff_event_normal'   => $other['data'][30],
@@ -3995,6 +3995,22 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
         'ff_type'               => $other['data'][35],
     ];
 
+    $plugin = db_get_row('tplugin', 'id', $values['id_plugin']);
+    if (empty($plugin)) {
+        returnError('id_not_found');
+        return;
+    }
+    $plugin_command_macros = $plugin['macros'];
+
+    if (!empty($values['macros'])) {
+        $macros = io_safe_input_json($values['macros']);
+        if (empty($macros)) {
+            returnError('JSON string in macros is invalid.');
+            exit;
+        }
+        $values['macros'] = io_merge_json_value($plugin_command_macros, $macros);
+    }
+
     if (! $values['descripcion']) {
         $values['descripcion'] = '';
         // Column 'descripcion' cannot be null.
@@ -4145,13 +4161,29 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3)
             $values[$field] = $other['data'][$cont];
 
             if ($field === 'macros') {
-                $values[$field] = base64_decode($values[$field]);
+                $values[$field] = base64_decode(str_replace('&#x20', '+', $values[$field]));
             }
         }
 
         $cont++;
     }
 
+    $plugin = db_get_row('tplugin', 'id', $values['id_plugin']);
+    if (empty($plugin)) {
+        returnError('id_not_found');
+        return;
+    }
+    $plugin_command_macros = $plugin['macros'];
+
+    if (!empty($values['macros'])) {
+        $macros = io_safe_input_json($values['macros']);
+        if (empty($macros)) {
+            returnError('JSON string in macros is invalid.');
+            exit;
+        }
+        $values['macros'] = io_merge_json_value($plugin_command_macros, $macros);
+    }
+
     $values['policy_linked'] = 0;
     $result_update = modules_update_agent_module($id_module, $values);
 
@@ -8317,7 +8349,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
         return;
     }
 
-    if ($other['data'][22] == '') {
+    if ($other['data'][21] == '') {
         returnError('The plugin module could not be added. Id_plugin cannot be left blank.');
         return;
     }
@@ -8360,7 +8392,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
     $values['plugin_pass'] = $other['data'][23];
     $values['plugin_parameter'] = $other['data'][24];
     $values['disabled_types_event'] = $disabled_types_event;
-    $values['macros'] = base64_decode($other['data'][26]);
+    $values['macros'] = base64_decode(str_replace('&#x20', '+', $other['data'][26]));
     $values['module_macros'] = $other['data'][27];
     $values['each_ff'] = $other['data'][28];
     $values['min_ff_event_normal'] = $other['data'][29];
@@ -8375,6 +8407,22 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
         }
     }
 
+    $plugin = db_get_row('tplugin', 'id', $values['id_plugin']);
+    if (empty($plugin)) {
+        returnError('id_not_found');
+        return;
+    }
+    $plugin_command_macros = $plugin['macros'];
+
+    if (!empty($values['macros'])) {
+        $macros = io_safe_input_json($values['macros']);
+        if (empty($macros)) {
+            returnError('JSON string in macros is invalid.');
+            exit;
+        }
+        $values['macros'] = io_merge_json_value($plugin_command_macros, $macros);
+    }
+
     $success = enterprise_hook('policies_create_module', [$other['data'][0], $id, 4, $values, false]);
 
     if ($success) {
diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php
index 5edc3e5f49..ec888735f2 100755
--- a/pandora_console/include/functions_io.php
+++ b/pandora_console/include/functions_io.php
@@ -622,3 +622,82 @@ function io_safe_html_tags(string $string)
 
     return $output;
 }
+
+/**
+ * Execute io_safe_input againt each values in JSON.
+ *
+ * @param string json
+ *
+ * @return string json where each value is encoded
+ */
+function io_safe_input_json($json)
+{
+    $output_json = "";
+
+    if (empty($json)) {
+        return $output_json;
+    }
+
+    $array_json = json_decode($json, true);
+    if (json_last_error() != JSON_ERROR_NONE) {
+        return $output_json;
+    }
+
+    foreach ($array_json as $key => $value) {
+        if (is_array($value)) {
+            $value_json = json_encode($value, JSON_UNESCAPED_UNICODE);
+            $array_json[$key] = json_decode(io_safe_input_json($value_json), true);
+        } else {
+            $array_json[$key] = io_safe_input($value);
+        }
+    }
+    $output_json = json_encode($array_json, JSON_UNESCAPED_UNICODE);
+
+    return $output_json;
+}
+
+/**
+ * Merge json value in $json_merge to $json
+ *
+ * @param string  json to be merged.
+ * @param string  json containing the values to merge.
+ * @param boolean limit the values to be merged to those with a key of 'value', true by default.  
+ *
+ * @retrun string merged json
+ *
+ * e.g.)
+ *   arg1 json: {"1":{"macro":"_field1_","desc":"DESCRIPTION","help":"HELP","value":"","hide":""}}
+ *   arg2 json: {"1":{"value":"xxxx"}}
+ *   -> return json: {"1":{"macro":"_field1_","desc":"DESCRIPTION","help":"HELP","value":"xxxx","hide":""}}
+ */
+function io_merge_json_value($json, $json_merge, $value_key_only=true)
+{
+    $output_json = "";
+
+    $array_json = json_decode($json, true);
+    if (json_last_error() != JSON_ERROR_NONE) {
+        return $output_json;
+    }
+    $array_json_merge = json_decode($json_merge, true);
+    if (json_last_error() != JSON_ERROR_NONE) {
+        return $output_json;
+    }
+
+    foreach ($array_json_merge as $key => $value) {
+        if (is_array($value) && !empty($array_json[$key])) {
+            $merged_json = io_merge_json_value(
+                json_encode($array_json[$key], JSON_UNESCAPED_UNICODE),
+                json_encode($value, JSON_UNESCAPED_UNICODE),
+                $value_key_only);
+            $array_json[$key] = json_decode($merged_json, true);
+        } else {
+            if (array_key_exists($key, $array_json) &&
+                ($value_key_only == false || $key == 'value')) {
+                $array_json[$key] = $array_json_merge[$key];
+            }
+        }
+    }
+    $output_json = json_encode($array_json, JSON_UNESCAPED_UNICODE);
+
+    return $output_json;
+}
diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css
index 63a0bb6e85..be38bac7cc 100644
--- a/pandora_console/include/styles/pandora_black.css
+++ b/pandora_console/include/styles/pandora_black.css
@@ -351,7 +351,7 @@ ul.tree-group
 /* login.css */
 div.login_nick input,
 div.login_pass input {
-  background-color: #fff !important;
+  background-color: #111 !important;
 }
 
 /* user edit */
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 83601a38e7..52eea082b5 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
         <div style='height: 10px'>
             <?php
             $version = '7.0NG.755';
-            $build = '210705';
+            $build = '210709';
             $banner = "v$version Build $build";
 
             error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index d2cb35a712..4f366fce70 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.755
-%define release     210705
+%define release     210709
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index c4bcccce8a..968b86c575 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.755
-%define release     210705
+%define release     210709
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index a12a0ba1ff..5964dbf54d 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.755
-%define release     210705
+%define release     210709
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index ddd73ce65d..22cf4a6c9d 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 7.0NG.755-210705
+Version: 7.0NG.755-210709
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 3a85053310..9c231109da 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.755-210705"
+pandora_version="7.0NG.755-210709"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index af49b5b0ee..d62836b943 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -46,7 +46,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.755";
-my $pandora_build = "210705";
+my $pandora_build = "210709";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 6b662f9bba..11dfcd4ad1 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.755";
-my $pandora_build = "210705";
+my $pandora_build = "210709";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index df23cd01da..18af9106f3 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.755
-%define release     210705
+%define release     210709
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 7f01599176..2b52638484 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.755
-%define release     210705
+%define release     210709
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 50820ffd6f..d5ef7dbe1b 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.755"
-PI_BUILD="210705"
+PI_BUILD="210709"
 
 MODE=$1
 if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index ef586b934c..f9c9366fcb 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -35,7 +35,7 @@ use PandoraFMS::Config;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "7.0NG.755 Build 210705";
+my $version = "7.0NG.755 Build 210709";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 371dad3e70..3e5cec2f5b 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "7.0NG.755 Build 210705";
+my $version = "7.0NG.755 Build 210709";
 
 # save program name for logging
 my $progname = basename($0);