Moved rescue so variables are still set.