cleanup on deletion
this should be more efficient
A test would be nice.
Merge bug25403