fix bugs with assigning wrong outjoins