safeguarding against infinite loops in simulation