FIX: Flag operations used logical instead of bitwise operators