fix copy2buffer bug, terminator position