Fixes issue with incorrect order of types when building repositories.