Problem in making polycurves from curves

I have a script that make Finish walls for rooms and it actually takes boundry curves, gives it offset and make walls over it.
I have to make polycurve of boundary curves for each room becasue i have to give offset. Because when i try to give offset to curves it gives offset to each curve separately and give problem in corners as seen in picture.

j2

That is why i make polycurve, give offset and then again split into individual curves and it goes good. The problem is that i dont want finish walls where Room dividing line is. So i filter it out in beginning and then our group of curves for room sometimes look like this:

j3

And it sometimes do not make polycurves from these (depending on starting curve in these group of curves). As shown in this picture, it gives “Null” on Index 6 and 9.

So if anyone can help me out: Either giving to offset to curves but some avoid those corner problems or make polycurve from curves which is somehow not completely closed as shown in 2nd picture. Thanks