Hello!
I canot give you final solution as there is no example of the HTML. I suppose it is something to do with Xpath expression that returns incorrect nodes in the nodeset. Also,sometimestag has no href attribute, i.e. link as Ajax navigation element. So, try to run your Xpath on the page using something like Xpath checker for Firefox and watch the output.
If you can provide the example page where your app malfunctions and piece of code for link extraction, I can be more specific.