Bit manipulation problems