Change use of LogAnd to If.

This piece of code previously assumed short-circuiting semantics for LogAnd.