Fix bug when deleting branches