Infinity jigsaw structure generating

Hey! I'm creating a datapacks for mod that adds dimension with infinity labyrinth, and I got problems with generating. The structures doesn't connects correctly, they are crooked like in the pictures below. Does anyone know of any way to reduce such crooked connections?
Continue to help post