diff --git a/matlab/@dates/dates.m b/matlab/@dates/dates.m
index c442b4bb2b1e0946104dc0a808396487f3b556be..99093bfe7aa26564ecabebce63368007d1ead316 100644
--- a/matlab/@dates/dates.m
+++ b/matlab/@dates/dates.m
@@ -62,7 +62,7 @@ function dd = dates(varargin) % --*-- Unitary tests --*--
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-if nargin>0 && isequal(varargin{1},'initialize')
+if nargin>0 && ischar(varargin{1}) && isequal(varargin{1},'initialize')
     dd = struct('ndat', 0, 'freq', NaN(0), 'time', NaN(0,2));
     dd = class(dd,'dates');
     assignin('base','emptydatesobject',dd);
diff --git a/matlab/@dseries/dseries.m b/matlab/@dseries/dseries.m
index 213800c70a9702655558c89a82e9590b32ee3cea..b905ef31a7454ce740fecc7550f69133ead21579 100644
--- a/matlab/@dseries/dseries.m
+++ b/matlab/@dseries/dseries.m
@@ -76,7 +76,7 @@ function ts = dseries(varargin) % --*-- Unitary tests --*--
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-if nargin>0 && isequal(varargin{1},'initialize')
+if nargin>0 && ischar(varargin{1}) && isequal(varargin{1},'initialize')
     ts = struct;
     ts.data  = [];
     ts.nobs  = 0;