Fix error in Programmatic API copy