fixed a crash bug when switching between apps