A faster cadence in a lower gear is sometimes the solution. If you are mashing a higher gear the bike will tend to sway side to side and also jump as you put the extra pressure on the down stroke. Both make it more difficult to ride the bike smooth and straight. Think circles as you are pedaling for a smoother stroke and ride.