Set your metronome to something simple, like say 60 bpm and do the exercise until you can play it through smoothly and without error. Then increase the speed of the metronome. When you think you've nailed it at 80 bpm, turn the metronome down to 70bpm and start again. Do the same when you get up to 90 bpm, 100 bpm, 110 and so on.
We do this in the Classical world when practicing tremelo in p-a-m-i format, and it's the best way to prevent not only simple little slips like yours but also "galloping".
Have fun,
Alan :-)