Fix attaching refs of wrapped polymorphic to root.
Wrapping polymorphic models completed by executing middleware.