fixed the query yet again, and added the Site_id to the wf_settings