Fixed a bug when deleting tabs