diff --git a/src/service/service/task_scheduler/TaskExecutor.py b/src/service/service/task_scheduler/TaskExecutor.py
index 5c5747970c6accf3c76da6d4ffb60de48edbcdac..fdfcb903b59e4780e1c66ba3a9ee698bf4bea6f9 100644
--- a/src/service/service/task_scheduler/TaskExecutor.py
+++ b/src/service/service/task_scheduler/TaskExecutor.py
@@ -122,17 +122,16 @@ class TaskExecutor:
         optical_config_id = OpticalConfigId()
         optical_config_id.opticalconfig_uuid = device.device_id.device_uuid.uuid
         optical_config = OpticalConfig()
-        setting = settings.value if settings else ""
+        setting = settings.value if settings else ''
 
-        new_config = {}
         try:
             result = self._context_client.SelectOpticalConfig(optical_config_id)
-            new_config = json.loads(result.config)
-            if result is not None :
+            if result is not None:
+                new_config = json.loads(result.config)
                 new_config["new_config"] = setting
                 new_config["is_opticalband"] = is_opticalband
                 new_config["flow"] = flows
-                result.config = str(new_config)
+                result.config = json.dumps(new_config)
                 optical_config.CopyFrom(result)
                 self._device_client.ConfigureOpticalDevice(optical_config)
             self._store_grpc_object(CacheableObjectType.DEVICE, device_key, device)