Incorporating the changes to deleteItem @mr-mig incorporated in commit e0ed3e15720b767710557bb51ceb7cac3d259817.