fixed a bug while deleting