Make Polyline/Polygon not overwrite the source array

Fixes #1092
Fixes #1246
Fixes #1426