Fixed error with boolean check