clean up memcopy