fix a bug in the simulation