fix delete logic