fixed sql query log