cfbot reminds that this patch does not apply any more. So I've rebasedit on master, and also adjusted the test cases a bit.
ThanksRichard