fixed a potential bug when shadows/lights remove themselves (attached to entities)