Fixing bug where attach deletes oldcomponent.