fixed a major bug which used insert the data again and again, also made restart easy