Fix a bug about zero lengh edges