Fix logic error with operator precedence comparison