Deal with NaN and Inf in Hessian of dynamic model

Checks for these cases in stochastic_solvers.m to prevent cryptic crashes in dll-files later on