Fixed constant bugs of join queries.