Fixed an issue with SQLite and multiple where clauses (with tests)