app: fix the destruction process.