Merge pull request #1171 from ey6es/master

Sanity check to prevent crash in Model::simulate.