Fix a bug when deleting