bug fix for join