changed nested try statements