diff --git a/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php b/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
index a0b644b..7cb55f0 100644
--- a/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
+++ b/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
@@ -186,6 +186,7 @@ class IHMParamManagerClass
 	 
 		//check templated parameter
 		$real_param_id = $paramId;
+		$paramPath = "";
 		if ($this->templateParamsManager->isTemplatedParam($paramId)) {
 			$paramPath = $this->templateParamsManager->generateTemplatedParamFile($paramId, $templateArgs, $tableLink);
 			$real_param_id = $this->templateParamsManager->getTemplatedParamId($paramId, $templateArgs);
@@ -202,7 +203,7 @@ class IHMParamManagerClass
 
 		$this->addLinkedLocalParams($paramId, $paramsData, $templateArgs);
 			
-		return array("id" => $real_param_id, "indexes" => $indexes, "calib_infos" => $calib_infos);
+		return array("id" => $real_param_id, "indexes" => $indexes, "calib_infos" => $calib_infos, "path" => $paramPath);
 	}
 
 	/*
diff --git a/src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php b/src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php
index 613675e..a8b3d17 100644
--- a/src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php
+++ b/src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php
@@ -40,6 +40,9 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
 		$outputsNode = $requestNode->getOutputsNode();
 		$downloadNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::DOWNLOAD);
 
+		// hash is used to be sure to have a unique file name for two differents requests
+		$hash = "";
+
 		switch (strtoupper($input->timeformat))
 		{
 			case 'ISO08601' :
@@ -51,6 +54,7 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
 			default :
 				$downloadNode->setTimeFormat(RequestOutputDownloadTimeFormatEnum::ISO);
 		}
+		$hash .= $input->timeformat;
 
 		switch ($input->fileformat)
 		{
@@ -77,7 +81,7 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
 		//add params to output
 		$resultFile = WSInputOutputClass::getService();
 		$isFirst = true;
-		
+
 		foreach ($input->list as $param)
 		{
 			$paramInfo = $this->paramManager->addExistingParam($param->paramid, $this->paramsData/*, $param->template_args*/);
@@ -86,14 +90,14 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
 			$downloadNode->addParam($paramInfo['id'],$paramInfo['indexes'],$paramInfo['calib_infos']);
 			$paramsNode->addParam($paramInfo['id']);
 
-			if ( WSInputOutputClass::getService() == WSConfigClass::DATASET && $isFirst) 
+			if ( (WSInputOutputClass::getService() == WSConfigClass::DATASET) && $isFirst) 
 			{
-				$resultFile .= "_".$this->getDatasetIdFromParamInfo($param->paramid);
+				$resultFile .= "_".$input->file_info;
 				$isFirst = false;
 			}
 			elseif  ( WSInputOutputClass::getService() != WSConfigClass::DATASET )
 			{
-				$resultFile .= "_".$paramInfo['id'];
+				$resultFile .= "_".$input->file_info;
 				if (!empty($paramInfo['indexes']))
 					foreach ($paramInfo['indexes'] as $index)
 						$resultFile .= "_".$index;
@@ -105,7 +109,13 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
 		{	
 			$downloadNode->setSamplingTime($input->sampling);
 			$downloadNode->setStructure(RequestOutputDownloadStructureEnum::ONE_FILE);
-		}	
+			$hash .= $input->sampling;
+		}
+		else if ($input->ref_sampling_param)
+		{
+			$downloadNode->setStructure(RequestOutputDownloadStructureEnum::ONE_FILE_REFPARAM);
+			$hash .= $input->ref_sampling_param;
+		}
 		else {
 				$downloadNode->setStructure(RequestOutputDownloadStructureEnum::ONE_FILE_PER_PARAMETER_PER_INTERVAL);
 		}
@@ -123,7 +133,7 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
 				$resultFilePrefix = "output-";
 		}
 		
-		$resultFile .= "_".date("Ymd\THis", strtotime($input->startDate))."_".date("Ymd\THis",strtotime($input->stopDate));
+		$resultFile .= '_' . md5($hash) . "_".date("Ymd\THis", strtotime($input->startDate))."_".date("Ymd\THis",strtotime($input->stopDate));
 
 		$this->paramsData->addWaitingResult(WSInputOutputClass::getService(), $resultFile.$extension);
 		
@@ -179,18 +189,6 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
 		return $result;
 	}
 	
-	protected function getDatasetIdFromParamInfo($paramId)
-	{
-		$paramInfoFilePath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml";
-		$dom = new DomDocument("1.0");
-		
-		$dom->load($paramInfoFilePath);
-		
-		return $dom->getElementsByTagName("dataset_id")->item(0)->nodeValue;
-		 
-	
-	}
-	
 	/*
 	 * @brief method to marshall the result of a download request
 	*/
--
libgit2 0.21.2