fixed some bugs in the simulator