fix bugs in set_bit