Added a safety check, that ensures even elements yet to be assigned an ID can be sucessfully removed