fixing join issue where it could pick up the wrong table for some relations