Modify test code
Use memcpy instead of naive copying