Fixes #5509: do not delete parent of what you delete