added method to clean cache in case of exception