swapped order of evaluation on an if() to avoid comparing against unintialized values

(really only affected valgrind, but worth ordering appropriately)