Fixed a simulation bug