Bug fix in Sim.java