I think that just replacing `toParent()` to `toParent2()` and remove following while loop will fix the ICE.