Fix hasMany bug