Fix a ClassCastException when looking at the internals of an InvocationTargetException.