I haven't got a clue what you're doing there Grisu, but I just tried that code on an old B3d project (13 files totalling about 18,000 lines of code) and it worked fine?
Anyway, that's besides the point as it was intended as a base for you to create your own version for BMax.
Anyway, that's besides the point as it was intended as a base for you to create your own version for BMax.