Fix issue with instantiating related models.