Fix issue in sdb_query