It's based on a search algorithm (essentially a rule or set of rules) that finds the fastest way from A to B and moves the character in that direction. If A and B are the same, the result will always be the same.
Let me try to determine, though, what might be the problem.
Let's assume point A is at (5, 5) and B is at (7, 7). Your goal is to move from A to B. That's +2 in the x, and +2 in the y. From the first time you call, it determines you need to move (+2, +2), right? And that's what happens. Are you then calling it again, from another position that's not (5, 5) and it's going (+2, +2), rather than calculating from the new (x, y) to (7, 7)? For example, you are calling it at (2, 2) and it's going to (4, 4), and not (7, 7) like expected?
That's the only thing I can think of that would be a bug. If you are calling it again from (5, 5), then it's working as intended. But if you go from (5, 5) to (7, 7) on the first call, then the second call from (7, 7) makes it go to (9, 9) instead of staying still (since it's already there), then it's a problem.