turned on logging, and made minor correction to an if {...} block.