I think you should test whether the value is a string before applying `trim()`, otherwise values will be converted back to strings.