Once a mistake has been identified and a practice passage isolated, it is ready to be fixed. First, break the passage down horizontally, eliminating all but the hand (or feet) where the core problem exists. Find a tempo that is slow enough to allow you to stay in complete control.
Now fix the passage by playing many CORRECT REPETITIONS slowly. How many repetitions? Enough that to play it correctly is much easier than to play it incorrectly. To eliminate a bad habit you must replace it with a good one, so more repetitions over a period of time are required than when first learning a passage.
After many (perhaps twenty) perfect repetitions can be played in a row, work towards more repetitions at a slightly faster tempo. Repeat this process until reaching proficiency at a designated tempo. Do it again the next practice session, and again the next, until the old habit is replaced with a new one.