diff --git a/sen2chain/indices_functions.py b/sen2chain/indices_functions.py
index cd96f4765f662d67277f967a156e9f3aaef20ec1..caa8749a99ce72aedd1e44bf8963f64516ab04e3 100644
--- a/sen2chain/indices_functions.py
+++ b/sen2chain/indices_functions.py
@@ -337,7 +337,8 @@ def create_masked_indice(
                   resampling=Resampling.nearest)
 #        indice_borders_mask = np.where(raw_indice > 0, raw_indice, 32767)
         indice_cloud_mask = np.where(cld_reproj == 0, raw_indice, 32767)
-
+        if indice_path.suffix == ".jp2":
+            indice_cloud_mask = np.where(indice_cloud_mask == 16383, 32767, indice_cloud_mask)
         profile.update(driver="Gtiff",
                         compress="DEFLATE",
                         tiled=False,