Fixed a bug in the Douglas Peucker simplification function.