Removed copy to local string and the fixing part of the overlapping pointer