convert.c: remove some redundant logic
Fix possible crash if value is a reference with fmt=raw
Workaround for localized setting values with older perls

For some reason we can identify the offending SV if SvTYPE(sv) ==
SVt_PVMG. I've only tested this on Perl 5.10.1 with CentOS 6