partial implementation of copyFrom