fix some coverity errors on string copy