fixed removing of non existing elements.