Fixed bug where units that change team at end of turn cause an invalid operation exception.