Model: fixes on handling n:m relations