added tab switch check