Fix crash when removing components