Added checks to prevent 'item already deleted' infinite error loop