Convert to string only if necessary