Fixed a bug while deleting.