Fix error in replaceWith & cloneNodes