fix some bugs regarding simulation and others.