Fix memcpy when read data error from device