Fixed crashing, and non-player entities getting stuck in portals.