Fix order-of-operations bug causing scansys --debug mode to crash.