Fixed crash bug on onDestroy