improve handling of binary output