Fixes issue causing exception when entities start getting recycled