Fix some problems deleting tabs