Keys Recoded?

Recently had a bit of drama with the keys to my MK4 Mondeo and wondered if anyone else had had the same problem. (Keyless entry).

Approximately 2 hours from home stopped off for a cup of coffee and when we returned to the car it unlocked but the keys could not be detected by the car. Very long wait for AA man, very long wait in garage to be told that the keys had to be recoded. Frantic phonecalls to Ford UK, 2 hours later (plus 4 cappuccinos) problem solved. Hope this doesnt happen again, or is the immoboliser playing up?