fix binary encoding