fix sql_query() calls