Bug fixes for many to many join