v2.40, fix multiple inheritance bug in joins with the same table twice