added binary write, debug write