Fix exception handling for bug 853005