Oh it should be only before the last occurrence. I was able to duplicate your original problem and these changes do correct the issue. If the article is saved in the post cache, the erroneous version might still be used. You can see an uncached version by adding ?redirect=no or &redirect=no to the URL, for /showwiki/ or showwiki.php URLs respectively.