add missing if block to get rid of JSHint errors