Fixed bug when deleting detail items