Fix a potential deadlock with simulation.