Make removing of elements work fine