Fix HasManyThrough dictionary foreign key bug