fixed a bug in ear clipping algorithm