Fix Polyline issue.

This fixes part of issue #641 where part of a straight polyline disappears, but not the missing endpoints. See the issue for more details.