fix bug for not correctly converting join sql queries