refactor to avoid bug where associations where not loaded correctly