fixed the crash when switching tab. but still need to solve the problem that tab is not updating.