corrected the simulation