FLUID-5131: moved string replacement to a function