ManyToMany relationship tests and fixes