Issue with PShape with a cut off area and a changing vertex

Hey, I’d like to wirte a simple sketch where some vertices of a shape with an cut off are changed. Unfortunately, it doesn’t work as expected.
If I choose the default renderer, the shape is not closed as intended (see this bug )
If I choose P2D I get some strange artefacts while changing the vertex. If the new coordinates of the vertex are greater than the original values (here 50), the shape is not anymore shown correctly.

Is the P2D behaviour also some kind of a bug?

PShape s;

void setup() {
  size(200, 200, P2D); // issue with alteres vertexes
  //size(200, 200); // default rendere works with setVertex, but doesn't close the shape +
                    // ignores beginContour(), endContour()

  // Make a shape
  s = createShape();
  s.beginShape();

  // Exterior part of shape
  s.vertex(-50, -50);
  s.vertex(50, -50);
  s.vertex(50, 50);
  s.vertex(-50, 50);

  // Interior part of shape
  s.beginContour();
  s.vertex(-20, -20);
  s.vertex(-20, 20);
  s.vertex(20, 20);
  s.vertex(20, -20);
  s.endContour();

  // Finish off shape
  s.endShape(CLOSE);
}

void draw() {
  background(204);
  float x =  map(mouseX, 0, width, 30, 70);
  float y = map(mouseY, 0, height, 30, 70);
  fill(255, 0, 0);
  text("x: " + round(x) + ", y: " + round(y), 10, 12);

  fill(255);
  s.setVertex(2, x, y );
  translate(width/2, height/2);
  shape(s);
}