fix and optimize removal