memcpy part is revised