Fixed behaviour when removing elements (basic version).