Hardened script, protection against division by 0, see bug #2. Thanks to Ian Clancy for reporting !