output must be in binary format