Add copyField to C++ and Ruby and fix existing newField bug