update quit logic