Fix polygon/polyline tests and minor cleanup