SQLite fixes

Fix to handling of query with multiple