I would just remove the 2 bolts that hold the driven gear to the driveshaft tube, then make sure the drive gear is in position on the driveshaft. Check the driven gear for wear. What year are you working on, as there are different cables?
I've got it working now, I think the inner cable was back to front. I assumed that the inner cable was the correct way because the speedometer used to work after a fashion.