diff --git a/modules/conop/src/compound_lib.cc b/modules/conop/src/compound_lib.cc
index 2ec4ea8b2bbd62e65c1e67e649e617ce006d530f..befb94b4a73bf618d1cd75ec25504cbad2ea6a1a 100644
--- a/modules/conop/src/compound_lib.cc
+++ b/modules/conop/src/compound_lib.cc
@@ -632,7 +632,7 @@ CompoundPtrList CompoundLib::FindCompounds(const String& query,
       // next row
       ret=sqlite3_step(stmt);
     }
-    assert(SQLITE_DONE==sqlite3_step(stmt));
+    assert(SQLITE_DONE==ret);
   } else {
     LOG_ERROR("ERROR: " << sqlite3_errmsg(db_->ptr));
     sqlite3_finalize(stmt);