writing a single bit to a stream