add check before cleaning