Force the BOOLs to be 0 or 1 when processing flags.

We were using bitmasks and so ending up with integer values in there.
This causes confusion when comparing against YES (which you shouldn't
be doing, but still there's no need for the confusion).