Fix bug involving trying to downcast to a type that cannot be loaded.