terminate properly on remove