Bit mask changed to type casting