Fix small bugs in the simulator code.