RIP: fix crash at the end of the simulation