should replace __NAME__ with new index in added elements