If $replace parameter was not an array, convert it to array