fix the duplicate join bug