Change iodata_to_binary to chardata_to_string and remove unused
variables