Fixed bugs in Simulation