Added the removeChild at the wrong level. Ended up removing the element that we were going to use as element to set the id and src from others.