Update simulator.java

Fixed a bug