Fix bug in boolean check