Add type checking for logical operators