Fix wrong new elements id assignment