diff --git a/matlab/IMAS/complete_IDS_CORSICA.m b/matlab/IMAS/complete_IDS_CORSICA.m
index c62e762521d4b56caf4ceac55c993250e745dc47..306f18c0533010eb8345a4b4ae282160a7543fb5 100644
--- a/matlab/IMAS/complete_IDS_CORSICA.m
+++ b/matlab/IMAS/complete_IDS_CORSICA.m
@@ -1,7 +1,7 @@
 function IDS_out = complete_IDS_CORSICA(IDS_in,varargin)
 %
 %
-% 
+%
 doread = 0;
 dosave = 0;
 
@@ -14,9 +14,9 @@ if doread
 
   data_path_in = '/NoTivoli/carpanes/LIU_RAP_ITER/CORSICA_ids/CORSICA_130510.mat';
   %path_IDS = '/NoTivoli/carpanes/LIU_RAP_ITER/CORSICA_ids/CORSICA_130506.mat';
-  
+
   data_path_out = '/NoTivoli/carpanes/LIU_RAP_ITER/CORSICA_ids/CORSICA_130510_extended_COCOS17.mat';
-  
+
   % Load the IDS_in file
   IDS_out = load(data_path_in);
 else
@@ -26,9 +26,9 @@ end
 %% Correct COCOS convention on original data
 
 % Put homogenous = 0 on magnetic but 1 on the coils.
-% Sign of the angle of the magnetic probes. 
+% Sign of the angle of the magnetic probes.
 
-%% 
+%%
 G = G_ITER_generator;
 % Get the structure from generating files
 
@@ -51,8 +51,8 @@ for ii = 1:numel(tmp.names)
         IDS_out.pf_active.coil{jj}.name = regexprep(IDS_out.pf_active.coil{jj}.name,'[\n\r]+','');
         if strcmp(tmp.names{ii},IDS_out.pf_active.coil{jj}.name)
             IDS_out.pf_active.coil{jj}.element{1}.geometry.geometry_type = 2; % Rectangle description
-            IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.r = tmp.R(ii); 
-            IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.z = tmp.Z(ii); 
+            IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.r = tmp.R(ii);
+            IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.z = tmp.Z(ii);
             IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.width = tmp.dR(ii);
             IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.height = tmp.dZ(ii);
             IDS_out.pf_active.coil{jj}.element{1}.turns_with_sign = tmp.N(ii);
@@ -98,11 +98,12 @@ IDS_out.wall.description_2d{1}.limiter.unit{1}.outline.z = tmp.z;
 
 %%  -------------- Synthetic diagnostics------------ Need to be recomputed from CORSICA flux map
 
-IDS_out.magnetics.method{1}.ip.time = LXC.t; 
+IDS_out.magnetics.method{1}.ip.time = LXC.t;
 IDS_out.magnetics.method{1}.ip.data = LXC.Ip;
 
 % Correct IDS magnetics
-magnetics_default = ids_gen('magnetics');
+aa = gdat([],'ids','source','magnetics');
+magnetics_default = aa.magnetics;
 mag_fluxloop_def_fields = fieldnames(magnetics_default.flux_loop{1});
 if isfield(IDS_out.magnetics,'flux_loop') && length(IDS_out.magnetics.flux_loop) > 0
   mag_fluxloop_fields = fieldnames(IDS_out.magnetics.flux_loop{1});
@@ -133,7 +134,6 @@ end
 
 %% Bm
 % Correct IDS magnetics
-magnetics_default = ids_gen('magnetics');
 mag_bpol_probe_def_fields = fieldnames(magnetics_default.bpol_probe{1});
 if isfield(IDS_out.magnetics,'bpol_probe') && length(IDS_out.magnetics.bpol_probe) > 0
   mag_bpol_probe_fields = fieldnames(IDS_out.magnetics.bpol_probe{1});
@@ -176,7 +176,7 @@ for ii=1:numel(tmp.name)
     IDS_out.magnetics.bpol_probe{ii}.field.time = LXC.t;
 end
 
-%% Ft 
+%% Ft
 mag_method_def_fields = fieldnames(magnetics_default.method{1});
 if isfield(IDS_out.magnetics,'method') && length(IDS_out.magnetics.method) > 0
   mag_method_fields = fieldnames(IDS_out.magnetics.method{1});
diff --git a/matlab/IMAS/gdat_imas.m b/matlab/IMAS/gdat_imas.m
index 0e2cf4d7512f4d98717b814edefc5fb629813db3..49722c68b2d4c4eb031b8ecaf499b9982d377a16 100644
--- a/matlab/IMAS/gdat_imas.m
+++ b/matlab/IMAS/gdat_imas.m
@@ -438,7 +438,7 @@ elseif strcmp(mapping_for_imas.method,'switchcase')
     for i=1:length(ids_top_names)
       ids_top_name = ids_top_names{i};
       if ids_gen_ok
-	ids_empty = ids_gen(ids_top_name); % generate ids from gateway function ids_gen
+	ids_empty = ids_gen(ids_top_name); % generate ids from ids_gen
       else
 	% load empty ids structure from template file
 	fname = sprintf('ids_empty_%s',ids_top_name);
@@ -469,6 +469,7 @@ elseif strcmp(mapping_for_imas.method,'switchcase')
 	  gdat_data.(ids_top_name) = ids_top;
 	else
 	  gdat_data.(ids_top_name) = ids_empty;
+	  return
 	end
       catch ME_imas_ids_get
 	disp(['there is a problem with: imas_get_ids_' ids_top_name ...
diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m
index d716210ccd3c8e529bfa4057f52d80f64dd9c6a0..796f3c0e1e5a39d7c799a6f5713d83a531ba178a 100644
--- a/matlab/TCV/gdat_tcv.m
+++ b/matlab/TCV/gdat_tcv.m
@@ -140,7 +140,11 @@ if nargin>=1
   if isempty(shot)
     % means mdsopen(shot) already performed or not shot asked for
     try
-      shot_mds = mdsipmex(2,'$SHOT');
+      if ~mdsremotelist
+	shot_mds = shot;
+      else
+	shot_mds = mdsipmex(2,'$SHOT');
+      end
     catch
       shot_mds = shot;
     end
@@ -150,14 +154,20 @@ if nargin>=1
     if ischar(shot) || isempty(shot)
       if gdat_params.nverbose>=1
         if isstruct(data_request) && isfield(data_request,'data_request')
-          warning(['shot cannot be opened with ' data_request.data_request]);
-        elseif ischar(data_request)
-          warning(['shot cannot be opened with ' data_request]);
+	  if ~strcmp(data_request.data_request,'ids')
+	    warning(['shot cannot be opened with ' data_request.data_request]);
+	    return
+	  end
+        elseif ischar(data_request) 
+	  if ~strcmp(data_request,'ids')
+	    warning(['shot cannot be opened with ' data_request]);
+	    return
+	  end
         else
           warning(['shot cannot be opened']);
+	  return
         end
       end
-      if ~strcmp(data_request,'ids'); return; end % empty shot return empty ids so valid command
     end
   elseif isnumeric(shot)
     gdat_data.shot = shot;