fixed incorrect condition statement for joins and includes