Sometimes taking a flat file to the top of the bar will even out different rail heights. A tilted chain could cause wander to once side or the other.
Also, if you take a straight edge to the side of a tooth, push it to the side, you should see daylight between the straight edge and the bar. If not, the bar, or chain, are worn and would need replacing. Some try to squeeze the bar rails to close the gap, but I've never tried it, and I hear of results that vary. I've also heard that it can be a short lived fix. If the bar channel is worn wide, some go to a fatter chain - instead of .043, go to .050 etc. Results may vary there too. Flip the bar every so often to get even wear. Cutters that are filed uneven could cause wander to one side. Use a dial caliper and measure tooth size. If you get a bunch that are shorter, think about either filing to get the others to match, or take it to a grinder to do them all at once to the same size.
I've had bars worn so bad, the saw will simply not cut - the curve was greater than the bar could navigate.