Try to prevent infinite loop in resolving type references.