Removed extraneous string-encoding code in write_binary