Properly format custom-simple fields for comparison

The foreach loop here breaks out the custom into an array, then the next foreach loop trys to compare the value
against this list but the array is sanitized so if there is any special chars in there it won't match.

Related to #2360