[fix bug 984298] Check that identifier exists before cleaning.