added replace-char function