Fix loading of custom types defined in external modules.