fixed crash when switching between tabs