ensure that v is a string before attempting to trim it, and if value is an empty array that gets passed to valueToText, make the first element an empty string.