Fixing replacing string issue