Add some additional error checks.
autoupdate: fix logic error