implement binary mode