An immediate issue I've noticed is that
CCF_VGM is meant to be a bit flag.
Bit flags are an integer with each bit representing a true/false (or on/off, 0/1) state. This means you want each individual flag to look like this, so that each flag is on it's own bit:
Code:
FLAG1 = 00000001 (1 in decimal)
FLAG2 = 00000010 (2 in decimal)
FLAG3 = 00000100 (4 in decimal)
FLAG4 = 00001000 (8 in decimal)
...
FLAG8 = 10000000 (128 in decimal)
However, you set
CCF_VGM to 3 which means it's like this:
00000011. This means setting
CCF_VGM currently sets
CCF_NORMAL|CCF_ADMIN instead of being it's own flag. This might be causing the logic errors.
To fix this, make the new flag the next available power of 2 - in this case, setting
CCF_VGM to 8.
Change that over, and see if any issues remain.