Bug fix for defining types in external modules