Fix IO_Write for strings which are not in IsStringRep

Also add a test case for the issue.

Fixes #19, closes #20, closes #20, fixes #21, resolves #23