Adaptmesh and periodic boundary conditions

Hello, I am having problems with using adaptmesh with periodic boundary conditions. I found that others have experienced similar issues in the past, but I’m wondering if there is a solution in my case.
Any help is appreciated. Thank you!

The code below generates an error message
" current line = 22
Exec error : Periodic: the both number of edges is not the same
– number :1"

///////// CODE //////////////////////////////////////
// Mesh
border C01(t=0, 10pi){x=t; y=0; label=1;}
border C02(t=0, 2
pi){x=10pi; y=t; label=2;}
border C03(t=0, 10
pi){x=10pi-t; y=2pi; label=3;}
border C04(t=0, 2pi){x=0; y=2pi-t; label=4;}

int n=10;
int m=10;

mesh Th=buildmesh(C01(n)+C02(m)+C03(n)+C04(m), fixedborder=1);

func f=cos(x)*sin(y);

// Fespace
fespace Vh(Th,P1,periodic=[[2,y],[4,y], [1,x],[3,x]]);
Vh fh = f;
plot(fh);

// Adaptmesh
for (int i = 0; i < 2; i++){
Th = adaptmesh(Th, fh);
fh = f; //old mesh is deleted
plot(Th, fh, wait=true);
}