Fix terminateSimulation