Replace pointer with memcpy