Added condition to replace only for strings.