Fixed a bunch of issues with the retargeting of imported entities