Bug fix in logical comparisons