I’ve noticed something interesting. When I remove all console loggings from your code, I’m unable to reproduce the issue anymore.
It seems that logging geometries, materials etc. leads to a preservation of the respective objects. We had the same issue once at github which caused quite some confusion
Please remove all console.log
statements and try it again.