fixed the bit to int cast