Fix an error with string replace() method on attributes caused by #198