implementing binary output fix suggested by K-Sensei