fix tab switch crash