BUG: do a boolean check on casting bool to other types

avoids some issues of booleans coming from external buffers that may not
only contain 0 or 1.
closes #3801.
Merge pull request #3802 from juliantaylor/bool-check

BUG: do a boolean check on casting bool to other types