Fix index value in set_bit. Reported and corrected by Alberto.