The script is copied directly from the Live Shipping Rate Modification (https://wiki.foxycart.com/snippets/shipping/live_rate_shipping_modification
), and I have only changed stuff in the custom shipping logic area.
What happens is like this:
When I put in an address in France, I get the correct shipping cost and everything looks good. Then, if I simply change the address to one in Canada, the cost next to "Shipping Methods" is more than twice what it should be, while the cost next to "Shipping & Handling" is much too low. Not to mention that the two don't match. :-) If I refresh the checkout page and put in the Canada address, I get correct and matching amounts.