diff --git a/matlab/histvalf_initvalf.m b/matlab/histvalf_initvalf.m
index 5723d997960808d5e8704da5de5ce9bc865f3f26..7afb359d4258b4491b8c7d1b6c40fa30b3fd8491 100644
--- a/matlab/histvalf_initvalf.m
+++ b/matlab/histvalf_initvalf.m
@@ -197,7 +197,7 @@ end
if ~first_obs_ispresent
if isfield(options, 'first_simulation_period')
- if options.first_simulation_period < options.maximum_lag
+ if options.first_simulation_period < M.orig_maximum_lag
error(sprintf([caller, '_FILE: first_simulation_period = %d', ...
'must be larger than the maximum lag (%d)'], ...
options.first_simulation_period, M.orig_maximum_lag))
@@ -250,7 +250,7 @@ elseif isfield(options, 'lastobs')
' inconsistent information. Use only two of these', ...
' options.'])
else
- last_obs = options.last_obs;
+ last_obs = options.lastobs;
end
else
last_obs = options.last_obs;