fix sql_query() calls
Merge commit 'github/testing' into beta