simplify write_bit