handling background/active transition. fixed forced disconnect bug