Fixed bug in calculating curve length for singular curves