fix crash when deleting tabs