fixed bug olivier blanvillain pointed out