Fix the errors in the simulation