there is adjustment screw on the body near the plate for doing that job, it lets the inner cog the chain it on move in and out, look for it, and turn it and you will see how it works, when you get the chain back on just turn the screw to make the chain tight, but not too tight, thats why the chain came off. it was not tight, check youtube on chainsaw , and you will see how it done.
m, January 2015