diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn
index b7d353d6e867b4508cf252b991e68aa6eaac61b3..03fa44671a0a8247acdead924d62f4615130fe96 100644
--- a/LibOneM2M/OneM2M_Functions.ttcn
+++ b/LibOneM2M/OneM2M_Functions.ttcn
@@ -1648,7 +1648,6 @@ module OneM2M_Functions {
     			
 				var MsgIn v_response;
 				var RequestPrimitive v_request;
-				var integer v_localResourceIndex := -1;
 				var PrimitiveContent v_remoteCSEResource;
 
 				v_request := f_getCreateRequestPrimitive(int16, p_requestPrimitive, -1);
@@ -1662,7 +1661,7 @@ module OneM2M_Functions {
 						f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
 						vc_remoteCseIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1);
 						v_remoteCSEResource := f_cse_generateLocalResource(v_response.primitive.responsePrimitive.primitiveContent, vc_cSEBaseIndex, int16);
-						v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex);
+						vc_localRemoteCseIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex);
 					}
 					[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
 						tc_ac.stop;
@@ -1693,7 +1692,6 @@ module OneM2M_Functions {
 				var MsgIn v_request;
 				var ResponsePrimitive v_response;
 				var PrimitiveContent v_remoteCSEResource;
-				var integer v_localResourceIndex := -1;
 				var integer v_resourceIndex := -1;
 				var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
 				var charstring v_action := "Please, send a CSE registration request";
@@ -1707,12 +1705,12 @@ module OneM2M_Functions {
 						tc_ac.stop;
 						setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly");
 						v_remoteCSEResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_
-						v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex);
+						vc_localRemoteCseIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex);
 						
 						v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
 						v_response.from_ := PX_CSE1_ID;
 						v_response.to_ := v_request.primitive.requestPrimitive.from_;
-						v_response.primitiveContent.remoteCSE := vc_localResourcesList[v_localResourceIndex].resource.remoteCSE;
+						v_response.primitiveContent.remoteCSE := vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE;
 						mccPortIn.send(m_response(v_response));
 						
 						v_resourceIndex := f_setResource(v_request.primitive.requestPrimitive.primitiveContent, int16, -1);
diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn
index 54dc9add8f2993e47de744336ce425d7b8a17d5f..51a4ccd3372bae68a3b3e2e7af4270c3351ed8f1 100644
--- a/LibOneM2M/OneM2M_TestSystem.ttcn
+++ b/LibOneM2M/OneM2M_TestSystem.ttcn
@@ -63,6 +63,7 @@ module OneM2M_TestSystem {
 		var MyResourcesList vc_localResourcesList := {};
 		var AeSimu vc_ae1;//For CF02 when CseSimu is master
 		var integer vc_remoteCseIndex;
+		var integer vc_localRemoteCseIndex;
 		var integer vc_cSEBaseIndex;	//Index of the CSEBase resource of the Tester inside vc_localResourcesList
 	};
 	
diff --git a/OneM2M_Testcases_CSE.ttcn b/OneM2M_Testcases_CSE.ttcn
index ba378a195aaafebe9c6f4d37e0bbaf1029d66c3c..700294dd883af1048c7c71cd884e624ce2082e27 100644
--- a/OneM2M_Testcases_CSE.ttcn
+++ b/OneM2M_Testcases_CSE.ttcn
@@ -2802,7 +2802,7 @@ module OneM2M_Testcases_CSE {
 						 // Preamble
 						 v_aeIndex := f_cse_createResource(int2, p_createRequestPrimitive, -1);
 		 
-						 mcaPort.send(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(v_aeIndex))));//TODO Maybe PX_SUPER_AE_ID
+						 mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex))));//TODO Maybe PX_SUPER_AE_ID
 						 tc_ac.start;
 						 alt {
 							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
@@ -2922,7 +2922,7 @@ module OneM2M_Testcases_CSE {
 				    
 					 v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
  
-					 mccPort.send(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex))));
+					 mccPort.send(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))));
 					 tc_ac.start;
 					 alt {
 						 [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
@@ -2951,7 +2951,7 @@ module OneM2M_Testcases_CSE {
 					
 					v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
 					
-					mccPort.send(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex))));
+					mccPort.send(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))));
 					tc_ac.start;
 					alt {
 						 [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
@@ -3067,7 +3067,7 @@ module OneM2M_Testcases_CSE {
 						// Preamble
 						if(PICS_IN_CSE){
 							vc_remoteCseIndex := f_cse_registerRemoteCse(p_createRequestPrimitive);
-							mccPort.send(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex))));
+							mccPort.send(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))));
 						    tc_ac.start;
 							alt {
 								[] mccPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
@@ -3092,7 +3092,7 @@ module OneM2M_Testcases_CSE {
 							}
 						} else if (PICS_MN_CSE){
 							vc_remoteCseIndex := f_cse_registrationRemoteCse(p_createRequestPrimitive);
-							mccPort.send(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex))));
+							mccPort.send(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))));
 							tc_ac.start;
 							alt {
 								[] mccPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
@@ -3224,7 +3224,7 @@ module OneM2M_Testcases_CSE {
 					 vc_remoteCseIndex := f_cse_registrationRemoteCse(m_createRemoteCSEBase);
 					 
 					 //Send Trigger Message
-					 v_utRequest := m_utRetrieveResource(f_getLocalResourceAddress(vc_remoteCseIndex), PX_CSE_ID);
+					 v_utRequest := m_utRetrieveResource(f_getLocalResourceAddress(vc_localRemoteCseIndex), PX_CSE_ID);
  				     v_utRequest.from_ := "UNINITIALIZED";
 					 f_sendUtPrimitive(v_utRequest, v_action);
 					 
@@ -3274,7 +3274,7 @@ module OneM2M_Testcases_CSE {
 					 
 					v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
 	 
-					 mccPort.send(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex))));
+					 mccPort.send(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))));
 					 tc_ac.start;
 					 alt {
 						[] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {