modified according to comments of Pascal and Bart.