Fixed bug in model builder with subtypes