Fixes mutability issues