Fixed the error when deleting.