change to use memcpy and memset in copying and zero-clearing object