Associations are not correctly extracted.

Only one association of each type can be extracted, as array is initialized inside the loop.