Fix issue with removal of elements