diff --git a/R/area-based.3.mapping.and.inference.Rmd b/R/area-based.3.mapping.and.inference.Rmd
index 517f61906f19262725cdb31e7e8d9b05d648aa12..0e0a31096ded1432099dd1c564ce28d85549d15e 100755
--- a/R/area-based.3.mapping.and.inference.Rmd
+++ b/R/area-based.3.mapping.and.inference.Rmd
@@ -447,7 +447,11 @@ model_public <- list(model = model_aba_stratified_mixed$model$public, stats = mo
 # produce corresponding map
 prediction_map_public <- lidaRtRee::aba_predict(model_public, metrics_map)
 # TEMPORARY fix to NA values in terra::merge (call by lidaRtRee::aba_predict)
-prediction_map_mixed <- terra::mosaic(prediction_map_public, prediction_map_private, fun = max)
+if (packageVersion("terra")<"1.7.3" | packageVersion("terra")>="1.7.8")
+{
+  warning("Merging with terra::mosaic because terra::merge in 1.7.3 and 1.7.6 does not handle NA values")
+  prediction_map_mixed <- terra::mosaic(prediction_map_public, prediction_map_private, fun = max)
+}
 ```
 
 ```{r plotmapForestStratified, include=TRUE, echo=FALSE, message=FALSE, warning=FALSE, fig.width = 12, fig.height = 6}