Fixes error with entity caused when a component is removed-then-added within the same iteration.