diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m
index 32e1fae5d11bdff465c69f013663f702820adc25..53a2d5362ec39879d6d8cc1f390beafdc35ab902 100644
--- a/matlab/global_initialization.m
+++ b/matlab/global_initialization.m
@@ -349,7 +349,7 @@ estimation_info.measurement_error_corr.range_index = {};
 estimation_info.structural_innovation_corr_prior_index = {};
 estimation_info.structural_innovation_corr_options_index = {};
 estimation_info.structural_innovation_corr.range_index = {};
-options_.initial_period = dates(1,1);
+options_.initial_period = NaN; %dates(1,1);
 options_.dataset.file = [];
 options_.dataset.series = [];
 options_.dataset.firstobs = dates();
diff --git a/matlab/perfect_foresight_solver.m b/matlab/perfect_foresight_solver.m
index 819b3b667f7f097b33bce822ba8d06e25816a7f0..ec88ab319312cf0df65070763c90273e7403baad 100644
--- a/matlab/perfect_foresight_solver.m
+++ b/matlab/perfect_foresight_solver.m
@@ -146,7 +146,13 @@ end
 
 dyn2vec;
 
-ts = dseries(transpose(oo_.endo_simul),options_.initial_period,cellstr(M_.endo_names));
+if isnan(options_.initial_period)
+    initial_period = dates(1,1);
+else
+    initial_period = options_.initial_period;
+end
+
+ts = dseries(transpose(oo_.endo_simul),initial_period,cellstr(M_.endo_names));
 assignin('base', 'Simulated_time_series', ts);
 
 end
diff --git a/matlab/utilities/dataset/makedataset.m b/matlab/utilities/dataset/makedataset.m
index 2b4653008a56a8e7ac4cca264dbf161a5d9fa1e6..72b04f7cf73a1fc704323ebed6150bc4f7e5c31f 100644
--- a/matlab/utilities/dataset/makedataset.m
+++ b/matlab/utilities/dataset/makedataset.m
@@ -114,7 +114,7 @@ else
 end
 
 %  Test if an initial period (different from its default value) is explicitely defined in the mod file with the set_time command.
-if isequal(DynareOptions.initial_period, dates(1,1))
+if ~isdates(DynareOptions.initial_period) && isnan(DynareOptions.initial_period)
     set_time_default_initial_period = 1;
 else
     set_time_default_initial_period = 0;
@@ -134,8 +134,7 @@ end
 
 if ~set_time_default_initial_period && ~dataset_default_initial_period
     % Check if dataset.init and options_.initial_period are identical.
-    if DynareOptions.initial_period>DynareDataset.init
-        %if  ~isequal(DynareOptions.initial_period, DynareDataset.init)
+    if DynareOptions.initial_period<DynareDataset.init
         error('The date as defined by the set_time command is not consistent with the initial period in the database!')
     end
 end