diff --git a/src/LHCbDIRAC/BookkeepingSystem/DB/LegacyOracleBookkeepingDB.py b/src/LHCbDIRAC/BookkeepingSystem/DB/LegacyOracleBookkeepingDB.py
index 9b6438ced06477e95c98c2b18899458da4c5ec2c..6ff382c02d585deb9888c1795669b29053aad98c 100644
--- a/src/LHCbDIRAC/BookkeepingSystem/DB/LegacyOracleBookkeepingDB.py
+++ b/src/LHCbDIRAC/BookkeepingSystem/DB/LegacyOracleBookkeepingDB.py
@@ -4080,7 +4080,7 @@ prod.production>0 AND prod.production=cont.production AND cont.processingid=%d"
             if len(quality) != 1 or str(quality[0]) != "OK":
                 return S_ERROR("ExtendedDQOK can be specified with DataQuality=OK only")
         else:
-            return S_ERROR("DataQuality OK must be explicitly specified to use ExtendedDQOK " + str(quality))
+            return S_ERROR(f"DataQuality OK must be explicitly specified to use ExtendedDQOK: {quality=}")
             # I leave it here if we wabt change the logic (set 'OK' when not specified at all)
             # mimic __buildDataquality("OK") when not specified
             # hardcoded into DB Schema as 2. But current BK test wipe it and set to 1...
diff --git a/src/LHCbDIRAC/BookkeepingSystem/Service/BookkeepingManagerHandler.py b/src/LHCbDIRAC/BookkeepingSystem/Service/BookkeepingManagerHandler.py
index aef4830e5d97c6832968ad7e9ae4157839f1727f..ebea52179cdbdf9d3da0032cc9916570bd10e661 100644
--- a/src/LHCbDIRAC/BookkeepingSystem/Service/BookkeepingManagerHandler.py
+++ b/src/LHCbDIRAC/BookkeepingSystem/Service/BookkeepingManagerHandler.py
@@ -573,7 +573,7 @@ class BookkeepingManagerHandlerMixin:
         evt = in_dict.get("EventType", in_dict.get("EventTypeId", default))
         production = in_dict.get("Production", default)
         filetype = in_dict.get("FileType", default)
-        quality = in_dict.get("DataQuality", in_dict.get("Quality", default))
+        quality = in_dict.get("DataQuality", in_dict.get("DataQualityFlag", in_dict.get("Quality", default)))
         visible = in_dict.get("Visible", "Y")
         replicaFlag = in_dict.get("ReplicaFlag", "Yes")
         startDate = in_dict.get("StartDate", None)
@@ -701,7 +701,7 @@ class BookkeepingManagerHandlerMixin:
         eventType = in_dict.get("EventType", in_dict.get("EventTypeId", default))
         production = in_dict.get("Production", default)
         fileType = in_dict.get("FileType", default)
-        dataQuality = in_dict.get("DataQuality", in_dict.get("Quality", default))
+        dataQuality = in_dict.get("DataQuality", in_dict.get("DataQualityFlag", in_dict.get("Quality", default)))
         startRun = in_dict.get("StartRun", None)
         endRun = in_dict.get("EndRun", None)
         visible = in_dict.get("Visible", "Y")
@@ -770,7 +770,7 @@ class BookkeepingManagerHandlerMixin:
         evt = in_dict.get("EventType", in_dict.get("EventTypeId", default))
         production = in_dict.get("Production", default)
         filetype = in_dict.get("FileType", default)
-        quality = in_dict.get("DataQuality", in_dict.get("Quality", default))
+        quality = in_dict.get("DataQuality", in_dict.get("DataQualityFlag", in_dict.get("Quality", default)))
         runnb = in_dict.get("RunNumbers", in_dict.get("RunNumber", default))
         start = in_dict.get("StartItem", 0)
         maxValue = in_dict.get("MaxItem", 10)
@@ -2114,7 +2114,7 @@ class BookkeepingManagerHandlerMixin:
         evt = in_dict.get("EventType", in_dict.get("EventTypeId", default))
         production = in_dict.get("Production", default)
         filetype = in_dict.get("FileType", default)
-        quality = in_dict.get("DataQuality", in_dict.get("Quality", default))
+        quality = in_dict.get("DataQuality", in_dict.get("DataQualityFlag", in_dict.get("Quality", default)))
         runnb = in_dict.get("RunNumber", default)
         if "Quality" in in_dict:
             cls.log.verbose("The Quality has to be replaced by DataQuality!")
diff --git a/src/LHCbDIRAC/ProductionManagementSystem/Client/ProductionRequest.py b/src/LHCbDIRAC/ProductionManagementSystem/Client/ProductionRequest.py
index b9554e07e69875e5f0e1847c4a05979072424278..6b06d3b852c53453d45b7f4eb87972ccc9ae53d2 100644
--- a/src/LHCbDIRAC/ProductionManagementSystem/Client/ProductionRequest.py
+++ b/src/LHCbDIRAC/ProductionManagementSystem/Client/ProductionRequest.py
@@ -929,7 +929,7 @@ class ProductionRequest:
                 bkQuery["DataQualityFlag"] = self.dqFlag.replace(",", ";;;").replace(" ", "")
 
             if self.extendedDQOK:
-                bkQuery["ExtendedDQOK"] = self.dqFlag.replace(",", ";;;").replace(" ", "")
+                bkQuery["ExtendedDQOK"] = self.extendedDQOK.replace(",", ";;;").replace(" ", "")
 
             if self.smog2State:
                 bkQuery["SMOG2"] = self.smog2State
diff --git a/src/LHCbDIRAC/ProductionManagementSystem/Utilities/ModelCompatibility.py b/src/LHCbDIRAC/ProductionManagementSystem/Utilities/ModelCompatibility.py
index faafe6ffef26503b7c384c33e5910911f9ef87c7..4c55e3329b6f2099488a403e5acb32a21b1677ad 100644
--- a/src/LHCbDIRAC/ProductionManagementSystem/Utilities/ModelCompatibility.py
+++ b/src/LHCbDIRAC/ProductionManagementSystem/Utilities/ModelCompatibility.py
@@ -428,9 +428,9 @@ def configure_input(pr, data, *, runs=None, startRun=None, endRun=None):
 
     pr.configName = scd["configName"]
     pr.configVersion = scd["configVersion"]
-    pr.dqFlag = scd["inDataQualityFlag"]
+    pr.dqFlag = scd["inDataQualityFlag"].replace(" ", "")
     if scd["inExtendedDQOK"]:
-        pr.extendedDQOK = scd["inExtendedDQOK"]
+        pr.extendedDQOK = ",".join(scd["inExtendedDQOK"])
     if scd["inSMOG2State"]:
         pr.smog2State = scd["inSMOG2State"]
     pr.dataTakingConditions = data["SimCondition"]
diff --git a/src/LHCbDIRAC/ProductionManagementSystem/scripts/dirac_production_request_run_local.py b/src/LHCbDIRAC/ProductionManagementSystem/scripts/dirac_production_request_run_local.py
index e4e8703f35ab390ea0b5e26eb5b912ddc46d7413..db1b4638df57061202f61f2d89e8d38352ba3245 100644
--- a/src/LHCbDIRAC/ProductionManagementSystem/scripts/dirac_production_request_run_local.py
+++ b/src/LHCbDIRAC/ProductionManagementSystem/scripts/dirac_production_request_run_local.py
@@ -312,6 +312,10 @@ def prepareProductionRequest(
             bkQueryDict = pr._getBKKQuery().copy()
             if "RunNumbers" in bkQueryDict:
                 bkQueryDict["RunNumbers"] = bkQueryDict["RunNumbers"].split(";;;")
+            if "DataQualityFlag" in bkQueryDict:
+                bkQueryDict["DataQualityFlag"] = bkQueryDict["DataQualityFlag"].split(";;;")
+            if "ExtendedDQOK" in bkQueryDict:
+                bkQueryDict["ExtendedDQOK"] = bkQueryDict["ExtendedDQOK"].split(";;;")
             result = returnValueOrRaise(BookkeepingClient().getFilesWithMetadata(bkQueryDict))
             if result["TotalRecords"] == 0:
                 raise ValueError("No input files found in the bookkeeping")