fix usage of primary key in eager loading of HasMany associations