Fix for UnicodeEncodeError, refs #253