Fixed binary convert, added unit test (issue #182)