fix minor crash bug on delete