fix deletion

Fix crash while deleting in issue #174