Use upgrade_exit() where needed, be sure to remove tmpfile