Fixed delete logic