Fixing edge cases in associations