removed unnecessary mem_copying.