fix sorting of undefined with string

Sorting with optional attributes doesn't work properly, as null gets converted to 0, and "string" < 0 is false, and "string" > 0 is false.

When converting 0 with a string, replace 0 by "" to fix this