Fix sqlalchemy many to many relationships