If you are sure your code is doing what it is supposed to be doing, but the results aren't what you expect, check a few things:
1) Spelling. Really. Especially if you are matching on a string or something, this can really throw you off.
2) Step through ALL the relevant code. Not just that one function you think is the problem.
3) As a corollary to 2), there's a good chance some other code is over-riding or ignoring the new code.