Fix crash on deletion

I already made this change 9 days ago, but it was removed for some
reason.