Bug fix: incorrect manipulation of bits.