The error happened when FlattenWorker was called on this object, and then got to enumerating the properties and called itself recursively down on line 247. The first run through went fine. The recursive call si where the error occurred. Not sure if it makes sense to rewrite this.