added some exceptions if problem with cleaning resources