wrap cleanup in begin..rescue..end